je voudrai modifier un plugin de mon portail

Eléphanteau du PHP | 34 Messages

22 juil. 2007, 21:52

bonjour à tous

j'utilise ce plugin pour présenter des videos
j'aimerai uploadé plusieur video en même temp car le plugin enregistre une seul video
j'aimerai en uploadé comme sur ma photo montage 4 videos

http://www.aqua-corail.net/XXXX/eplayer ... .png[/img]
<?php
/*
+---------------------------------------------------------------+
|        e107 website system
|        Cameron's Plugin-Maker Form Handler.
|        For the e107 CMS system originally by
|        ©Steve Dunstan 2001-2002
|        http://e107.org
|        [email protected]
|
|        Released under the terms and conditions of the
|        GNU General Public License (http://gnu.org).
|
|        Updated by bugrain, ([email protected]) May 2005
+---------------------------------------------------------------+
*/

class form {
   function form_open($form_method, $form_action, $form_name="", $form_target = "", $form_enctype="") {
      $method  = ($form_method   ? "method='".$form_method."'"  : "");
      $target  = ($form_target   ? " target='".$form_target."'" : "");
      $name    = ($form_name     ? " id='".$form_name."'"       : "");
      return "\n<form action='".$form_action."' ".$method.$target.$name.$form_enctype.">";
    }

   // Cameron's Form Function.
   function user_extended_element_edit($form_ext_name, $presetvalue, $fieldname) {
      global $pref,$key,$sql,$user_pref;
      $tabmonth[1]=EPLAYER_LAN_DATE_01;
      $tabmonth[2]=EPLAYER_LAN_DATE_02;
      $tabmonth[3]=EPLAYER_LAN_DATE_03;
      $tabmonth[4]=EPLAYER_LAN_DATE_04;
      $tabmonth[5]=EPLAYER_LAN_DATE_05;
      $tabmonth[6]=EPLAYER_LAN_DATE_06;
      $tabmonth[7]=EPLAYER_LAN_DATE_07;
      $tabmonth[8]=EPLAYER_LAN_DATE_08;
      $tabmonth[9]=EPLAYER_LAN_DATE_09;
      $tabmonth[10]=EPLAYER_LAN_DATE_10;
      $tabmonth[11]=EPLAYER_LAN_DATE_11;
      $tabmonth[12]=EPLAYER_LAN_DATE_12;

      $ut         = explode("|", $form_ext_name);
      $u_name     = ($ut[0] != "") ? $ut[0] : trim($form_ext_name);
      $u_type     = trim($ut[1]);
      $u_value    = stripslashes($ut[2]);
      $u_values   = explode(",", $u_value);
      switch ($u_type) {
         case "radio":
            for ($i=0; $i<count($u_values); $i++) {
               $checked = ($u_values[$i] == $presetvalue)? " checked='checked'" : "";
               $ret .="<label for='$fieldname$i'><input type='radio' name='$fieldname' id='$fieldname$i' value='$u_values[$i]' $checked  />$u_values[$i]</label><br />";
            };
            break;
         case "checkbox":
            for ($i=0; $i<count($u_values); $i++) {
               $checked = ($u_values[$i] == $presetvalue)? " checked='checked'" : "";
               $ret .="<input type='checkbox' name='".$fieldname."' value='".$u_values[$i]."' $checked /><br />";
            };
            break;
         case "dropdown":
            $ret ="<select class='tbox' style='width:200px' name='".$fieldname."'>";
            for ($i=0; $i<count($u_values); $i++) {
               $checked = ($u_values[$i] == $presetvalue)? " selected" : "";
               $ret .="<option value='$u_values[$i]' $checked >". $u_values[$i] ."</option />\n";
            };
            $ret .="</select>";
            break;
         case "dropdown2":
            $ret ="<select class='tbox' style='width:200px' name='".$fieldname."'>";
            for ($i=0; $i<count($u_values); $i++) {
               $split = explode(":",$u_values[$i]);
               $checked = ($split[0] == $presetvalue)? " selected" : "";
               $ret .="<option value='".$split[0]."' $checked >". $split[1] ."</option />\n";
            };
            $ret .="</select>";
            break;
         case "dropdown-readonly":
            $ret = $presetvalue."&nbsp;";
            break;
         case "text":
            $valuehere = ($presetvalue !="")? $presetvalue : $u_values[0];
            $size = ($u_values[1]) ? $u_values[1]:40;
            $ret .="<input class='tbox' type='text' name='".$fieldname."' size='$size' value='".htmlentities($valuehere, ENT_QUOTES) ."' maxlength='$u_values[2]' />";
            break;
         case "file":
            $valuehere = ($presetvalue !="")? $presetvalue : $u_values[0];
            $size = ($u_values[1]) ? $u_values[1]:40;
            $ret .="<input class='tbox' type='file' name='".$fieldname."' size='$size' maxlength='$u_values[2]' />";
            break;
         case "hidden":
            $ret .="<input type='hidden' name='".$fieldname."' value='".$u_values[0]."' />";
            break;
         case "color":
            $ret = Color_Select($fieldname,$presetvalue);
            break;
         case "textarea":
            $width = $u_values[1];
            $height = $u_values[2];
            $valuehere = $presetvalue;
            $ret .="<textarea id='".$fieldname."' class='tbox' name='".$fieldname."' cols='2' rows='2' style='width:$width;height:$height'>".htmlentities($valuehere, ENT_QUOTES) ."</textarea>";
            break;
         case "table":
            $ret ="<select class='tbox' style='width:200px' name='".$fieldname."'><option></option>";
            $fieldid = $row[$u_values[1]];
            $fieldvalue = $row[$u_values[2]];
            $sql -> db_Select($u_values[0],"*","$u_values[1] !='' ORDER BY $u_values[2]");
            while($row = $sql-> db_Fetch()) {
               $fieldid = $row[$u_values[1]];
               $fieldvalue = $row[$u_values[2]];
               $checked = ($fieldid == $presetvalue)? " selected" : "";
               $ret .="<option value='".$fieldid."' $checked > $fieldvalue </option>";
            }
            $ret .="</select>";
            break;
         case "table-readonly":
            $sql -> db_Select($u_values[0],"*"," $u_values[1] = '$presetvalue'");
            $row = $sql -> db_Fetch();
            $fieldvalue = $row[$u_values[2]];
            $fieldvalue .= ($u_values[3])? " - ".$row[$u_values[3]]:"";
            $ret =  $fieldvalue."&nbsp;";
            break;
         case "dir":
            $folder = $u_value;
            //  $ret = $folder;
            $handle=opendir($folder);
            while ($file = readdir($handle)) {
               if (is_dir($folder.$file) && $file !='CVS' && $file != "." && $file != ".." && $file != "/" ) {
                  $lanlist[] = $file;
               }
            }
            closedir($handle);
            $ret .= "<select style='width:150px' class='tbox' name='".$fieldname."' ><option></option>";
            for ($i=0; $i<count($lanlist); $i++) {
               $selected = ($lanlist[$i] == $presetvalue)? "selected = 'selected'" : "";
               $ret .="<option value=\"".$lanlist[$i]."\" $selected>".$lanlist[$i]."</option>";
            }
            $ret .= " </select>";
            break;
         case "image" :
            $folder = $u_value;
            $handle = opendir($folder);
            while ($file = readdir($handle)) {
               if (is_file($folder.$file) && (eregi(".jpg",$file) || eregi(".gif",$file) || eregi(".png",$file))) {
                  $iconlist[] = $file;
               }
            }
            closedir($handle);
            $ret = "<input class='tbox' style='width:300px' type='text' id='$fieldname' name='$fieldname' value='$presetvalue' maxlength='100' />
            <input class='button' type ='button' style='cursor:pointer' value='".EPLAYER_LAN_36."' onclick='expandit(this)' />
            <div id='".$fieldname."_box' style='display:none'>";

            foreach ($iconlist as $key=>$icon) {
               $ret .= "<a href=\"javascript:addicontext('$folder$icon','$fieldname')\" ><img src='".$folder.$icon."' style='border:0px' alt='' /></a> ";
            }
            $ret .= "</div>";
            break;
         case "accesstable":
            $ret ="<select class='tbox' style='width:200px' name='".$fieldname."'><option></option>";
            $checked = ($presetvalue == 0)? " selected" : "";
            $ret .="<option value='0' $checked > Everyone </option>";
            $checked = ($presetvalue == 252)? " selected" : "";
            $ret .="<option value='252' $checked > Guest Only </option>";
            $checked = ($presetvalue == 253)? " selected" : "";
            $ret .="<option value='253' $checked > Members Only </option>";
            $checked = ($presetvalue == 254)? " selected" : "";
            $ret .="<option value='254' $checked > Administrators Only </option>";
            $checked = ($presetvalue == 255)? " selected" : "";
            $ret .="<option value='255' $checked > No One (inactive) </option>";
            $sql -> db_Select('userclass_classes',"userclass_id, userclass_name"," ORDER BY userclass_name", "no_where");
            while($row = $sql-> db_Fetch()) {
               extract($row);
               $checked = ($userclass_id == $presetvalue)? " selected " : "";
               $ret .="<option value='".$userclass_id."' $checked > $userclass_name </option>";
            }
            $ret .="</select>";
            break;
         case "date":
            $day0    = $presetvalue ? substr($presetvalue,6,2) : substr($u_values[1],6,2);
            $month0  = $presetvalue ? substr($presetvalue,4,2) : substr($u_values[1],4,2);
            $year0   = $presetvalue ? substr($presetvalue,0,4) : substr($u_values[1],0,4);

            $dayname    = $fieldname."_day";
            $monthname  = $fieldname."_month";
            $yearname   = $fieldname."_year";

            $ret= "<select name=\"". $dayname."\"  class='tbox'><option></option>";
            for($i=1;$i<=31;$i++) {
               if ($i<10) {
                  $j="0$i";
               } else {
                  $j=$i;
               }
               if ($j==$day0) {
                  $ret.= "<option value='$j' selected>$j</option>";
               } else {
                  $ret.= "<option value='$j' >$j</option>";
               }
            }
            $ret.= "</select>";
            $ret.= "<select name=\"".$monthname."\"  class='tbox'><option></option>";
            for($i=1;$i<=12;$i++) {
               if ($i<10) {
                  $j="0$i";
                } else {
                  $j=$i;
               }
               if ($j==$month0) {
                  $ret.= "<option value='$j' selected>".$tabmonth[$i]."</option>";
               } else {
                  $ret.= "<option value='$j' >".$tabmonth[$i]."</option>";
               }
            }
            $ret.= "</select>";
            $ret.= "<select name=\"".$yearname."\"  class='tbox'><option></option>";
            $gettoday=getdate();
            $todayyear=$gettoday['year'];
            for($i=1900;$i<=$todayyear;$i++) {
               if ($i==$year0) {
                  $ret.= "<option value='$i' selected>$i</option>";
               } else {
                  $ret.= "<option value='$i' >$i</option>";
               }
            }
            $ret.= "</select>";
            break;
         case "datestamp":
            $day0    = ($presetvalue) ? date("j",$presetvalue):"";
            $month0  = ($presetvalue) ? date("n",$presetvalue):"";
            $year0   = ($presetvalue) ? date("Y",$presetvalue):"";

            $dayname    = $fieldname."_day";
            $monthname  = $fieldname."_month";
            $yearname   = $fieldname."_year";

            $ret = "<select name=\"". $dayname."\"  class='tbox'><option></option>";
            for($i=1;$i<=31;$i++) {
               if ($i<10) {
                  $j="0$i";
               } else {
                  $j=$i;
               }
               if ($j==$day0) {
                  $ret.= "<option value='$j' selected>$i</option>";
               } else {
                  $ret.= "<option value='$j' >$i</option>";
               }
            }
            $ret .= "</select>";

            $ret .= "<select name=\"".$monthname."\"  class='tbox'><option></option>";
            for($i=1;$i<=12;$i++) {
               if ($i<10) {
                  $j="0$i";
               } else {
                  $j=$i;
               }
                 if ($j==$month0) {
                  $ret.= "<option value='$j' selected>$tabmonth[$i]</option>";
               } else {
                  $ret.= "<option value='$j' >$tabmonth[$i]</option>";
               }
            }
            $ret .= "</select>";

            $ret .= "<select name=\"".$yearname."\"  class='tbox'><option></option>";
            $gettoday =getdate();
            $todayyear=$gettoday['year'];
            $yr_start = ($u_values[0]) ? $u_values[0] : 2000;
            $yr_end   = ($u_values[1]) ? $u_values[1] : $todayyear+1;

            for($i=$yr_start;$i<=$yr_end;$i++) {
               if ($i==$year0) {
                  $ret.= "<option value='$i' selected>$i</option>";
               } else {
                  $ret.= "<option value='$i' >$i</option>";
               }
            }
            $ret.= "</select>";
            break;
         default:
            $ret .="<input class='tbox' type='text' name='".$form_ext_name."' size='40' value='".$u_value."' maxlength='200' />";
            break;
      }
      return $ret;
   }

// OTHER FUNCTIONS. ===================

   // Get date from input fields
   function getfieldvalue($name, $type, $debug=false) {
      $tp = new textparse();
        if ($type == "date" || $type == "datestamp"){
           $year  = $name."_year";
           $month = $name."_month";
           $day   = $name."_day";

            if ($type == "date") {
                $value .= $_POST[$year]."-".$_POST[$month]."-".$_POST[$day];
            } else {
                $value .= mktime (0,0,0,$_POST[$month],$_POST[$day],$_POST[$year]);
            }
        } else {
            $value .= addslashes($tp->editparse($_POST[$name]));
        }
        if ($debug) print "$name ($type) = $value<br>";
      return $value;
   }

   // View Date Function.
   function viewdate($date0,$type='short') {  //format date0 2003-11-01
      $tabmonth[1] =EPLAYER_LAN_DATE_01;
      $tabmonth[2] =EPLAYER_LAN_DATE_02;
      $tabmonth[3] =EPLAYER_LAN_DATE_03;
      $tabmonth[4] =EPLAYER_LAN_DATE_04;
      $tabmonth[5] =EPLAYER_LAN_DATE_05;
      $tabmonth[6] =EPLAYER_LAN_DATE_06;
      $tabmonth[7] =EPLAYER_LAN_DATE_07;
      $tabmonth[8] =EPLAYER_LAN_DATE_08;
      $tabmonth[9] =EPLAYER_LAN_DATE_09;
      $tabmonth[10]=EPLAYER_LAN_DATE_10;
      $tabmonth[11]=EPLAYER_LAN_DATE_11;
      $tabmonth[12]=EPLAYER_LAN_DATE_12;
      if ($type =='short') {
         $tabmonth[1]   =substr(EPLAYER_LAN_DATE_01, 0, 3);
         $tabmonth[2]   =substr(EPLAYER_LAN_DATE_02, 0, 3);
         $tabmonth[3]   =substr(EPLAYER_LAN_DATE_03, 0, 3);
         $tabmonth[4]   =substr(EPLAYER_LAN_DATE_04, 0, 3);
         $tabmonth[5]   =substr(EPLAYER_LAN_DATE_05, 0, 3);
         $tabmonth[6]   =substr(EPLAYER_LAN_DATE_06, 0, 3);
         $tabmonth[7]   =substr(EPLAYER_LAN_DATE_07, 0, 3);
         $tabmonth[8]   =substr(EPLAYER_LAN_DATE_08, 0, 3);
         $tabmonth[9]   =substr(EPLAYER_LAN_DATE_09, 0, 3);
         $tabmonth[10]  =substr(EPLAYER_LAN_DATE_10, 0, 3);
         $tabmonth[11]  =substr(EPLAYER_LAN_DATE_11, 0, 3);
         $tabmonth[12]  =substr(EPLAYER_LAN_DATE_12, 0, 3);
      }

      $day0=substr($date0,8,2);
      $month0=substr($date0,5,2);
      $year0=substr($date0,0,4);

      if ($day0 != "") {
         $daylst = substr($day0,1,1);
         if ($daylst>="4" || $daylst == "0" || $day0 > 10) {
            $th = "th";
         } elseif ($daylst=="3" && $day0 != "13") {
            $th = "rd";
         } elseif ($daylst=="2" && $day0 != "12") {
            $th = "nd";
         } elseif ($daylst=="1" && $day0 != "11") {
            $th = "st";
         }
      }

      if (substr($day0,0,1)== "0") {     // remove the 0 on the day if found in first position.
         $day0 = str_replace("0","",$day0);
      }

      $newmonth = str_replace("0","",$month0);
      $ret = $day0.$th." ".$tabmonth[$newmonth]." ".$year0;
      return $ret;
   }
}

// Color-Code Selector v1.1 for e107 by Cameron.
// Adapted from Htmlarea v3.0

echo "<script type=\"text/javascript\">
// <![CDATA[


    function View(field,color) {
    var fieldname = 'ColorPreview_' + field;                 // preview color
        if (ValidateColor(color)) {
            document.getElementById(fieldname).style.backgroundColor = '#' + color;
            document.getElementById(field).value = color;
        } else {
            alert('Your color-code is not valid');
            document.getElementById(field).focus();
        }
    }

    function Set(field,string) {                   // select color
        var color = ValidateColor(string);
        if (color == null) { alert('Invalid color code: ' + string); }        // invalid color
        else {                         // valid color
            View(field,color);                          // show selected color
            document.getElementById(field).value = color;
        }
    }

    function ValidateColor(string) {                // return valid color code
      string = string || '';
      string = string + \"\";
      string = string.toUpperCase();
      var chars = '0123456789ABCDEF';
      var out   = '';

      for (var i=0; i<string.length; i++) {             // remove invalid color chars
        var schar = string.charAt(i);
        if (chars.indexOf(schar) != -1) { out += schar; }
      }

      if (out.length != 6) { return null; }            // check length
      return out;
    }
// ]]>
</script>";

   // Javascript stuff
   $js = "
<script type=\"text/javascript\">
   function addicontext(txt, id) {
      document.getElementById(id).value = txt;
   }
</script>\n";
   print $js;
?>
[/url]
Modifié en dernier par papayou_s le 26 juil. 2007, 14:41, modifié 1 fois.

ViPHP
ViPHP | 4674 Messages

22 juil. 2007, 22:51

Bonsoir, et merci pour ce beau screenshot qui m'a fait mal aux yeux.

HTML nous permet un super truc :

Code : Tout sélectionner

<form enctype="multipart/form-data" action="upload.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000" /> Send this file&nbsp;:<input name="userfile[]" type="file" /><br /> Send this file&nbsp;:<input name="userfile[]" type="file" /><br /> <input type="submit" value="Send" /> </form>
Le fait de définir le nom des champs de fichiers comme un tableau (userfile[]) envoie les fichiers du même nom sous forme de tableaux (Array) à PHP. Que l'on récupère avec la variable $_FILES.

A mon avis, c'est une piste ;-) (On ne fait pas les scripts sur commande, on vous aide à résoudre vos problèmes pour rappel ...)
« Un handicap est le résultat d'une rencontre entre une déficience ou différence et une incapacité de la société à répondre à celle-ci. »

Hoa : http://hoa-project.net (sur @hoaproject).

Mammouth du PHP | 19672 Messages

23 juil. 2007, 06:09

4 vidéos en même temps ??? À mon avis, tu vas avoir un plantage. Habituellement, ce type de fichier est assez lourd et le temps de traitement de ton formulaire risque fort de dépasser le timeout configuré dans ton php.ini. En local, tu peux l'ajuster comme tu veux, mais sur un hébergement mutualisé, tu seras coincé par une limite de 30 secondes.
Codez en pensant que celui qui maintiendra votre code est un psychopathe qui connait votre adresse :axe:

Eléphanteau du PHP | 34 Messages

23 juil. 2007, 06:41

merci pour vos messages

je suis débutant
ok pour le timeout configuré dans le php.ini.

c'est quoi ce code, dans le plugin aucune page en html

Code : Tout sélectionner

Code: <form enctype="multipart/form-data" action="upload.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000" /> Send this file&nbsp;:<input name="userfile[]" type="file" /><br /> Send this file&nbsp;:<input name="userfile[]" type="file" /><br /> <input type="submit" value="Send" /> </form>
On ne fait pas les scripts sur commande, on vous aide à résoudre vos problèmes pour rappel
oui je suis d'acord avec toi ,je voudrai savoir si c'est dans cette page que je dois modifier quelque chose et ou je dois le modfier

ici
case "file": 
            $valuehere = ($presetvalue !="")? $presetvalue : $u_values[0]; 
            $size = ($u_values[1]) ? $u_values[1]:40; 
            $ret .="<input class='tbox' type='file' name='".$fieldname."' size='$size' maxlength='$u_values[2]' />"; 
            break;
ou ici
case "image" : 
            $folder = $u_value; 
            $handle = opendir($folder); 
            while ($file = readdir($handle)) { 
               if (is_file($folder.$file) && (eregi(".jpg",$file) || eregi(".gif",$file) || eregi(".png",$file))) { 
                  $iconlist[] = $file; 
               } 
            } 
            closedir($handle); 
            $ret = "<input class='tbox' style='width:300px' type='text' id='$fieldname' name='$fieldname' value='$presetvalue' maxlength='100' /> 
            <input class='button' type ='button' style='cursor:pointer' value='".EPLAYER_LAN_36."' onclick='expandit(this)' /> 
            <div id='".$fieldname."_box' style='display:none'>"; 

            foreach ($iconlist as $key=>$icon) { 
               $ret .= "<a href=\"javascript:addicontext('$folder$icon','$fieldname')\" ><img src='".$folder.$icon."' style='border:0px' alt='' /></a> "; 
            } 
            $ret .= "</div>"; 
            break; 
merci à vous

ViPHP
ViPHP | 4674 Messages

23 juil. 2007, 09:28

Tu peux trouver sans problème où est-ce que tu dois intervenir.

Tu sais où ce trouve ton formulaire. Regarde la cible (@action) de ton formulaire. D'après tes dires, ce serait cette page. Tu hésites entre deux endroits ? Et bien, fais un echo dans une partie, et un autre echo dans une autre. Lances ton script, et tu seras fixé ! Quand on est pas sûr, c'est le meilleur moyen (au passage, fais des echos des données que la partie de ton script traite, tu gagneras du temps).

J'avais pas prêté attention à ça, mais Cyrano a parfaitement raison : 4 vidéos seront très lourdes, et longues à traiter. A mon avis, tu ne diriges pas vers la bonne piste, sauf si ce ne sont pas des vidéos trop lourdes. A toi de juger.
« Un handicap est le résultat d'une rencontre entre une déficience ou différence et une incapacité de la société à répondre à celle-ci. »

Hoa : http://hoa-project.net (sur @hoaproject).

Eléphanteau du PHP | 34 Messages

23 juil. 2007, 15:54

oui ,les fichier video ne seront pas lourds

j'ai fais également des echos pour voir les fichier qui était appelés
ou dois je metre c'est nouveaux echo . (je débute)

il y a celui si , j'ai vu qu il demandé pour un upload à cette ligne

// Check to see if we are uploading a file
<?php
/*
+---------------------------------------------------------------+
| ePlayer by bugrain (www.bugrain.plus.com)
|
| A plugin for the e107 Website System (http://e107.org)
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: E:/cvs/cvsrepo/eplayer/eplayer.php,v $
| $Revision: 1.30 $
| $Date: 2005/10/09 16:26:04 $
| $Author: Neil $
+---------------------------------------------------------------+
*/

echo "eplayer.php <br />";

   require_once("../../class2.php");
   require_once(e_PLUGIN."eplayer/eplayer_variables.php");
   define("PAGE_NAME", $pref['eplayer_title']);
   require_once(e_HANDLER."comment_class.php");
   require_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_comment.php");

   $eplayertable  = "eplayer";
   $categorytable = "eplayer_category";

   $aj   = new textparse;
   $sql2 = new db;
   $con  = new convert;
   $cobj = new comment;

   $clipsPerPage = $pref['eplayer_clips_per_page'];

   if(!is_object($gen)){
      $gen = new convert;
   }

   require_once(HEADERF);

   $text = "<table class='fborder' width='100%'>";

   // No query so display category list
   if (!e_QUERY) {
      $sql->db_Select($categorytable, "*", "cat_parent_category=0 order by cat_display_order asc");
      $text .= "<tr><td colspan='4' class='forumheader'>".EPLAYER_LAN_01."</td></tr>";

      while (list($catid, $catname, $catdescription, $caticon, $catdisplay_order) = $sql->db_Fetch()) {
         $qry = "select * from ".MPREFIX."$eplayertable as e
                  left join ".MPREFIX."$categorytable as c on e.category = c.cat_id
                  where (e.category=$catid
                     or (e.category=c.cat_id and c.cat_parent_category=$catid))
                     and e.approved='0'
                     ";
         $count = $sql2->db_Select_gen($qry);
         $numsubcats = $sql2->db_Count($categorytable." where cat_parent_category='$catid' and approved='0'");
         $text .= "<tr><td class='forumheader3' style='text-align:center'>";
         if ($count) {
            $text .= "<a href='eplayer.php?cat.$catid.0.$clipsPerPage'><img src='$caticon' style='border:0px' /></a></td>
                     <td class='forumheader3'><a href='eplayer.php?cat.$catid.0.$clipsPerPage'>$catname</a>";
         } else if ($numsubcats) {
            $text .= "<a href='eplayer.php?cat.$catid.0.$clipsPerPage'><img src='$caticon' style='border:0px' /></a></td>
                     <td class='forumheader3'><a href='eplayer.php?cat.$catid.0.$clipsPerPage'>$catname</a>";
         } else {
            $text .= "<img src='$caticon' style='border:0px' /></td>
                     <td class='forumheader3'>$catname";
         }
         $sql2->db_Select($eplayertable, "timestamp", "category=$catid and approved='0' order by timestamp desc limit 0,1");
         list($timestamp) = $sql2->db_Fetch();

         $ts = $gen->convert_date($timestamp, "short");
         $text .= "<br /><span class='smalltext'>$catdescription</span></td>
                  <td class='forumheader3' style='text-align:center'>$count ".EPLAYER_LAN_14.", $numsubcats ".EPLAYER_LAN_32."<br />".EPLAYER_LAN_23." $ts</td></tr>";
      }
      $text .= "<tr><td class='forumheader3' style='text-align:right' colspan='3'>";
      $text .= "<form method='post' action='eplayer.php?search'>";
      if (USER) {
         $text .= "<div style='float:left;'><a href='".e_SELF."?upload'>[".EPLAYER_LAN_46."]</a></div>";
      }
      $text .= "<div style='float:right'><input class='tbox search' type='text' name='search' size='20' value='' maxlength='50' />&nbsp;";
      $text .= "<input class='button search' type='submit' name='s' value='".EPLAYER_LAN_44."' />";
      $text .= "</div></form>";
      $text .= "</td></tr>";
   }

   switch ($pref["eplayer_display_order"]) {
      case EPLAYER_LAN_ADMIN_PREF_03_3 : {
         $order = "datestamp asc, timestamp asc";
         break;
      }
      case EPLAYER_LAN_ADMIN_PREF_03_4 : {
         $order = "datestamp desc, timestamp desc";
         break;
      }
      case EPLAYER_LAN_ADMIN_PREF_03_5 : {
         $order = "timestamp asc, datestamp asc";
         break;
      }
      case EPLAYER_LAN_ADMIN_PREF_03_6 : {
         $order = "timestamp desc, datestamp desc";
         break;
      }
      default : {
         $order = "title ASC";
         break;
      }
   }

   // Check to see if we are uploading a file
   if (eregi("upload", e_QUERY)) {
      $text .= "<tr><td>";
      $text .= eplayerAdd();
      $text .= "</td></tr>";
   }

   // Check to see if we are uploading a file
   if (eregi("submit", e_QUERY)) {
      // Check for mandatory fields
      $eplayer_filename = $_FILES["eplayer_filename"];
      if (strlen($eplayer_filename["name"][0]) == 0) {
         $message .= EPLAYER_LAN_ADMIN_MEDIA_03_0." ".EPLAYER_LAN_ADMIN_MEDIA_12;
      }
      if (strlen($_POST['title']) == 0) {
         $message .= EPLAYER_LAN_ADMIN_MEDIA_00_0." ".EPLAYER_LAN_ADMIN_MEDIA_12;
      }
      if (strlen($message) > 0) {
         $text .= "<tr><td>";
         $text .= eplayerAdd($message);
         $text .= "</td></tr>";
      } else {
         if (is_uploaded_file($eplayer_filename['tmp_name'][0])) {
            if ($_POST["mediatype"] == 0) {
               $eplayer_dir = $pref["eplayer_image_dir"];
            } else {
               $eplayer_dir = $pref["eplayer_media_dir"];
            }
            $eplayer_file = e_FILE.$eplayer_dir."/".ereg_replace("[^a-z0-9._]", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($eplayer_filename['name'][0]))));
            if (move_uploaded_file($eplayer_filename['tmp_name'][0], $eplayer_file)) {
               $query = "0, ";                              // id
               $query .= "'".$eplayer_file."', ";           // filename
               $query .= "'".$_POST["title"]."', ";         // title
               $query .= "'".$_POST["category"]."', ";      // category
               $datestamp = mktime (0,0,0,$_POST["datestamp_month"],$_POST["datestamp_day"],$_POST["datestamp_year"]);
               $query .= $datestamp.", ";                   // datestamp
               $query .= "'".$_POST["description"]."', ";   // description
               $query .= "'', ";                            // icon
               $query .= "0, ";                             // width
               $query .= "0, ";                             // height
               $query .= "'".USERNAME."', ";                // author
               $query .= "1, ";                             // comment
               $query .= time().", ";                       // timestamp
               $query .= "0, ";                             // lastview
               $query .= "0, ";                             // viewcount
               $query .= "1 ";                              // approved
               if ($sql2->db_Insert("eplayer", $query)) {
                  $text .= "<tr><td>";
                  $text .= eplayerAdd(EPLAYER_LAN_49);
                  $text .= "</td></tr>";
               } else {
                  print mysql_error();
                  $text .= "<tr><td>";
                  $text .= eplayerAdd(EPLAYER_LAN_48);
                  $text .= "</td></tr>";
               }
            } else {
               $text .= "<tr><td>";
               $text .= eplayerAdd(EPLAYER_LAN_48);
               $text .= "</td></tr>";
            }
         } else {
            print mysql_error();
            $text .= "<tr><td>";
            $text .= eplayerAdd(EPLAYER_LAN_48);
            $text .= "</td></tr>";
         }
      }
   }

   // Check to see if we are searching
   if (eregi("search", e_QUERY)) {
      $tmp     = explode(".", e_QUERY);

      $sql2->db_Select($categorytable, "*", "cat_id='$catid'");
      list($catid, $catname, $catdescription, $caticon, $catorder, $catparent) = $sql2->db_Fetch();
      $qry = "select * from ".MPREFIX."$eplayertable as e
               left join ".MPREFIX."$categorytable as c on e.category = c.cat_id
               where (e.category=$catid
                  or (e.category=c.cat_id and c.cat_parent_category=$catid))
                  and e.approved='0'
                  ";
      $count = $sql2->db_Select_gen($qry);
      $numsubcats = $sql2->db_Count($categorytable." where cat_parent_category='$catid' and approved='0'");
      $text .= "<tr><td colspan='3' class='np' style='text-align:left'><a href='eplayer.php'><< ".EPLAYER_LAN_22." ".EPLAYER_LAN_01."</a></td></tr>";
      if ($catparent) {
         $sql2->db_Select($categorytable, "*", "cat_id='$catparent'");
         if ($tmp = $sql2->db_Fetch()) {
            $text .= "<tr><td colspan='3' class='np' style='text-align:left'><a href='eplayer.php?cat.$catparent.0.$clipsPerPage'><< ".EPLAYER_LAN_22." ".$tmp['cat_name']."</a></td></tr>";
         }
      }
      $text .= "<tr><td colspan='2' class='forumheader' width='66%'>$catname<br /><span class='smalltext'>$catdescription</span></td>";
      $text .= "<td class='forumheader' style='text-align:center'>";
      $text .= "<span class='smallblacktext'>$count ".EPLAYER_LAN_14."</span>";
      $text .= "</td></tr>";

      $count = $sql->db_Count($eplayertable." WHERE category='$catid' and approved='0'");
      $search = $_POST["search"];
      if ($sql->db_Select($eplayertable, "*", "(title like '%$search%' OR description like '%$search%') and approved='0' ORDER BY $order", true)) {
         $text .= "<tr><td colspan='4' class='forumheader2'>".EPLAYER_LAN_27."</td></tr>";
         while ($row = $sql->db_Fetch()) {
            extract($row);
            $title         = $aj->tpa($title);
            $description   = $aj->tpa($description);

            $text .= "<td class='forumheader3' style='text-align:center'><a href='eplayer.php?view.$id.0.$clipsPerPage'><img src='$icon' style='border:0px' /></a></td>
                     <td class='forumheader3'><a href='eplayer.php?view.$id.0.$clipsPerPage'>$title</a><br />$description</td>
                     <td class='forumheader3' style='text-align:center'>".EPLAYER_LAN_21."$author";
            if ($datestamp > 0) {
               $date = $gen->convert_date($datestamp, "short");
               $text .= "<br />$date";
            }
            if ($timestamp > 0) {
               $date = $gen->convert_date($timestamp, "short");
               $text .= "<br />".EPLAYER_LAN_24.": $date";
            }
               $text .= "<br />".EPLAYER_LAN_41.": $viewcount";
            if ($lastview > 0) {
               $text .= "<br />".EPLAYER_LAN_42.": ".$gen->convert_date($lastview, "short");
            } else {
               $text .= "<br />".EPLAYER_LAN_43;
            }
            $text .= "</td></tr>";
         }
      } else {
         $text .= "<tr><td class='forumheader3' colspan='3'>".EPLAYER_LAN_45."</td></tr>";
      }

      $text .= "<tr><td class='forumheader3' style='text-align:right' colspan='3'>";
      $text .= "<form method='post' action='eplayer.php?search'>";
      $text .= "<input class='tbox search' type='text' name='search' size='20' value='$search' maxlength='50' />&nbsp;";
      $text .= "<input class='button search' type='submit' name='s' value='".EPLAYER_LAN_44."' />";
      $text .= "</form>";
      $text .= "</td></tr>";
   }

   // Check to see if we should be displaying clips in a category
   if (eregi("cat.", e_QUERY)) {
      $tmp     = explode(".", e_QUERY);
      $catid   = $tmp[1];
      $from    = $tmp[2];
      $view    = $tmp[3];

      $sql2->db_Select($categorytable, "*", "cat_id='$catid'");
      list($catid, $catname, $catdescription, $caticon, $catorder, $catparent) = $sql2->db_Fetch();
      $qry = "select * from ".MPREFIX."$eplayertable as e
               left join ".MPREFIX."$categorytable as c on e.category = c.cat_id
               where (e.category=$catid
                  or (e.category=c.cat_id and c.cat_parent_category=$catid))
                  and e.approved='0'
                  ";
      $count = $sql2->db_Select_gen($qry);
      $numsubcats = $sql2->db_Count($categorytable." where cat_parent_category='$catid' and approved='0'");
      $text .= "<tr><td colspan='3' class='np' style='text-align:left'><a href='eplayer.php'><< ".EPLAYER_LAN_22." ".EPLAYER_LAN_01."</a></td></tr>";
      if ($catparent) {
         $sql2->db_Select($categorytable, "*", "cat_id='$catparent'");
         if ($tmp = $sql2->db_Fetch()) {
            $text .= "<tr><td colspan='3' class='np' style='text-align:left'><a href='eplayer.php?cat.$catparent.0.$clipsPerPage'><< ".EPLAYER_LAN_22." ".$tmp['cat_name']."</a></td></tr>";
         }
      }
      $text .= "<tr><td colspan='2' class='forumheader' width='66%'>$catname<br /><span class='smalltext'>$catdescription</span></td>";
      $text .= "<td class='forumheader' style='text-align:center'>";
      $text .= "<span class='smallblacktext'>$count ".EPLAYER_LAN_14."</span>";
      $text .= "</td></tr>";

      // Displaying a category - check for sub-categories first
      $sql->db_Select($categorytable, "*", "cat_parent_category=$catid order by cat_display_order asc", true);

      if ($numsubcats > 0) {
         $text .= "<tr><td colspan='4' class='forumheader2'>".EPLAYER_LAN_26."</td></tr>";
      }

      while (list($parentcatid, $catname, $catdescription, $caticon, $catdisplay_order) = $sql->db_Fetch()) {
         $count = $sql2->db_Select($eplayertable, "*", "category=$parentcatid and approved='0' order by timestamp desc");

         $text .= "<tr><td class='forumheader3' style='text-align:center'>";
         if ($count) {
            $text .= "<a href='eplayer.php?cat.$catid.0.$clipsPerPage'><img src='$caticon' style='border:0px' /></a></td>
                     <td class='forumheader3'><a href='eplayer.php?cat.$parentcatid.0.$clipsPerPage'>$catname</a>";
         } else {
            $text .= "<img src='$caticon' style='border:0px' /></td>
                     <td class='forumheader3'>$catname";
         }

         list($eid, $filename, $title, $category, $datestamp, $description, $icon, $width, $height, $author, $comment, $timestamp) = $sql2->db_Fetch();

         $ts = $gen->convert_date($timestamp, "short");
         $text .= "<br /><span class='smalltext'>$catdescription</span></td>
                  <td class='forumheader3' style='text-align:center'>$count ".EPLAYER_LAN_14."<br />".EPLAYER_LAN_23." $ts</td></tr>";
      }

      $count = $sql->db_Count($eplayertable." WHERE category='$catid' and approved='0'");
      if ($sql->db_Select($eplayertable, "*", "category='$catid' and approved='0' ORDER BY $order LIMIT $from,$view", true)) {
         $text .= "<tr><td colspan='4' class='forumheader2'>".EPLAYER_LAN_27."</td></tr>";
         while ($row = $sql->db_Fetch()) {
            extract($row);
            $title         = $aj->tpa($title);
            $description   = $aj->tpa($description);

            $text .= "<td class='forumheader3' style='text-align:center'><a href='eplayer.php?view.$id.0.$clipsPerPage'><img src='$icon' style='border:0px' /></a></td>
                     <td class='forumheader3'><a href='eplayer.php?view.$id.0.$clipsPerPage'>$title</a><br />$description</td>
                     <td class='forumheader3' style='text-align:center'>".EPLAYER_LAN_21."$author";
            if ($datestamp > 0) {
               $date = $gen->convert_date($datestamp, "short");
               $text .= "<br />$date";
            }
            if ($timestamp > 0) {
               $date = $gen->convert_date($timestamp, "short");
               $text .= "<br />".EPLAYER_LAN_24.": $date";
            }
               $text .= "<br />".EPLAYER_LAN_41.": $viewcount";
            if ($lastview > 0) {
               $text .= "<br />".EPLAYER_LAN_42.": ".$gen->convert_date($lastview, "short");
            } else {
               $text .= "<br />".EPLAYER_LAN_43;
            }
            $text .= "</td></tr>";
         }
      }

      $text .= "<tr><td colspan='3'>";
      $text .= eplayerPaging($from, $view, $count, "cat.$catid");
      $text .= "</tr>";
   }

   // Check to see if we are playing a clip
   if (eregi("view.", e_QUERY)) {
      $tmp  = explode(".", e_QUERY);
      $id   = $tmp[1];
      $from = $tmp[2];
      $view = $tmp[3];

      // Check if we are posting comments
      if (isset($_POST['commentsubmit'])) {
         if (!$sql->db_Select("eplayer", "comment", "id = '{$id}'")) {
            header("location:".e_BASE."index.php");
            exit;
         } else {
            $row = $sql->db_Fetch();
            if ($row[0] && (ANON === TRUE || USER === TRUE)) {
               $cobj->enter_comment($_POST['author_name'], $_POST['comment'], "eplayer", $id, $pid, $_POST['subject']);
               if($pref['cachestatus']){
                  $e107cache->clear("comment.eplayer.{$sub_action}");
               }
            }
         }
      }

      $sql->db_Select($eplayertable, "*", "id='$id'");
      list($id, $filename, $title, $category, $datestamp, $description, $icon, $width, $height, $author, $comment, $timestamp, $lastview, $viewcount) = $sql->db_Fetch();

      // Increment view count
		$sql->db_Update($eplayertable, "lastview=".time().", viewcount=viewcount+1 WHERE id='$id'");

      $title       = $aj->tpa($title);
      $description = $aj->tpa($description);

      $sql2->db_Select($categorytable, "*", "cat_id='$category'");
      list($catid, $catname) = $sql2->db_Fetch();

      $text .= "<tr><td colspan='2' class='np' style='text-align:left'><a href='eplayer.php?cat.$catid.0.$clipsPerPage'><< ".EPLAYER_LAN_22." $catname</a></td></tr>";

      $text2 .= "<tr><td class='forumheader3' width='66%'><img src='".e_IMAGE.$pref["eplayer_icon_dir"]."/$icon' style='border:0px' align='middle' />";
      $text2 .= "&nbsp;$title<br /><span class='smalltext'>$description</span></td>";
      $text2 .= "<td class='forumheader3'>$author";
      if ($datestamp > 0) {
         $date = $gen->convert_date($datestamp, "short");
         $text2 .= "<br /><span class='smalltext'>$date</span>";
      }
      if ($timestamp > 0) {
         $date = $gen->convert_date($timestamp, "short");
         $text2 .= "<br /><span class='smalltext'>".EPLAYER_LAN_24.": $date</span>";
      }
      $text2 .= "</td></tr>";

      if ($pref['eplayer_show_clip_details'] == EPLAYER_LAN_ADMIN_PREF_06_2) {
         $text .= $text2;
      }

      $text .= "<tr><td colspan='2' class='forumtable2' style='text-align:center;'>";
      $mediaFunc = "eplayerGet".strtoupper(substr($filename, strrpos($filename, ".")+1));
      if(!function_exists($mediaFunc)) {
         $mediaFunc = "eplayerGetDefault";
      }
      $text .= call_user_func($mediaFunc, $filename, $width, $height);
      $text .= "</td></tr>";

      if ($comment == "1" && !$ep_e107v7) {
         $query = $pref['nested_comments'] ?
            "comment_item_id='$id' AND comment_type='$eplayertable' AND comment_pid='0' ORDER BY comment_datestamp" :
            "comment_item_id='$id' AND comment_type='$eplayertable' ORDER BY comment_datestamp";
         unset($text3);
         $sql2 = new db;
         if ($comment_total = $sql2->db_Select("comments", "*",  $query)) {
            $width = 0;
            while($row = $sql2->db_Fetch()) {
               // ** Need to sort out how to do nested comments here, see "" ($action), and ratings (broken in e107 CVS?)
               if ($pref['nested_comments']) {
                  $text3 .= $cobj->render_comment($row, $eplayertable, "comment", $id, $width, $subject, true);
               } else {
                  $text3 .= $cobj->render_comment($row, $eplayertable, "comment", $id, $width, $subject, true);
               }
            }
            if (ADMIN && getperms("B")) {
               $text3 .= "<div style='text-align:right'><a href='".e_ADMIN."modcomment.php?eplayer.$id'>".LAN_314."</a></div>";
            }
         }
      }

      $next = $prev = $lastid = 0;
      if ($sql->db_Select($eplayertable, "*", "category='$catid' and approved='0' ORDER BY $order", true)) {
         while ($row = $sql->db_Fetch()) {
            if ($row['id'] == $id) {
               $prev = $lastid;
               break;
            }
            $lastid = $row['id'];
         }
         if ($row = $sql->db_Fetch()) {
            $next = $row['id'];
         }
      }
      $text .= "<tr><td colspan='2'>";
      if ($prev > 0) {
         $text .= "<div class='smalltext' style='float:left'><a href='$PHP_SELF?view.$prev.$from.$view'><< ".EPLAYER_LAN_38."</a></div>";
      }
      if ($next > 0) {
         $text .= "<div class='smalltext' style='float:right'><a href='$PHP_SELF?view.$next.$from.$view'>".EPLAYER_LAN_39." >></a></div>";
      }
      $text .= "</td></tr>";

      if ($pref['eplayer_show_clip_details'] == EPLAYER_LAN_ADMIN_PREF_06_3) {
         $text .= $text2;
      }

      require_once(e_HANDLER."rate_class.php");
      $rater = new rater;
      $text .= "<tr><td colspan='2' style='text-align:right'>";
      if ($ratearray = $rater->getrating("eplayer", $id)) {
         for($c = 1; $c <= $ratearray[1]; $c++) {
            $text .= "<img src='".e_IMAGE."rate/".IMODE."/star.png' alt='' />";
         }
         if ($ratearray[2]) {
            $text .= "<img src='".e_IMAGE."rate/".IMODE."/".$ratearray[2].".png'  alt='' />";
         }
         if ($ratearray[2] == "") {
            $ratearray[2] = 0;
         }
         $text .= "&nbsp;".$ratearray[1].".".$ratearray[2]." - ".$ratearray[0]."&nbsp;";
         $text .= ($ratearray[0] == 1 ? RATELAN_0 : RATELAN_1);
      } else {
         $text .= RATELAN_4;
      }

      if (!$rater->checkrated("eplayer", $id) && USER) {
         $ratetext = $rater->rateselect("&nbsp;&nbsp;&nbsp;&nbsp;<b>".RATELAN_2, "eplayer", $id)."</b>";
         if (!$ep_e107v7) {
            $ratetext = str_replace("rate.php", "../../rate.php", $ratetext);
         }
         $text .= $ratetext;
      } else if(!USER) {
         $text .= "&nbsp;";
      } else {
         $text .= "&nbsp;-&nbsp;".RATELAN_3;
      }
      $text .= "</td></tr>";
   }

   $text .= "</table>";
   $ns->tablerender($pref['eplayer_title'], $text);
   if ((eregi("view.", e_QUERY)) && ($comment == "1")) {
      // e107 0.617
      if (!$ep_e107v7) {
         if (strlen($text3) > 0) {
            $ns->tablerender(LAN_5, $text3);
         }
         $cobj->form_comment("comment", "eplayer", $id, $subject, $content_type);
      } else {
         // e107 0.7
         $cobj->compose_comment("eplayer", "comment", $id, $width, $subject, $showrate=false);
      }
   }

   require_once(FOOTERF);
   exit;

function eplayerPaging($from, $view, $total, $qs) {
   if ($total == 0) {
      return;
   }

   $text = "<table width='100%'><tr>";
   $text .= "<td style='width:25%;text-align:left' class='np'>";
   if ($from > 0) {
      $s = $from - $view;
      $text .= "<span class='smalltext'><a href='$PHP_SELF?$qs.$s.$view'><&nbsp;".EPLAYER_LAN_16."</a></span></div>";
   }

   $start  = $from + 1;
   $finish = $from + $view;

   if ($finish > $total) {
      $finish = $total;
   }

   $text .= "&nbsp;</td><td style='width:50%;text-align:center' class='np'>";
   $text .= "<span class='smallblacktext'>".EPLAYER_LAN_18." $start ".EPLAYER_LAN_19." $finish ".EPLAYER_LAN_20." $total</span></td>";

   $s = $from + $view;
   $text .= "<td style='width:25%;text-align:right' class='np'>&nbsp;";
   if ($s < $total) {
      $text .= "<span class='smalltext'><a href='$PHP_SELF?$qs.$s.$view'>".EPLAYER_LAN_17."&nbsp;></a>&nbsp;</span></td>";
   }

   $text .= "</tr></table>";
   return $text;
}

function eplayerGetMOV($url, $w, $h) {
   // Add height to allow for controls area
   $h += 18;
   $text = "
      <object classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab' width='$w' height='$h'>
         <param name='src' value='$url'>
         <param name='autoplay' value='true'>
         <param name='controller' value='true'>
         <embed src='$url' width='$w' height='$h' autoplay='true' controller='true' pluginspage='http://www.apple.com/quicktime/download/'>
         </embed>
      </object>
      ";
   return $text;
}

function eplayerGetSWF($url, $w, $h) {
   global $pref;
   $size = getimagesize($url);
   $w = $size[0];
   $h = $size[1];
   if ($pref["eplayer_max_width"] != "") {
      $max = $pref["eplayer_max_width"];
      if ($w > $max) {
         $h = intval($h / ($w/$max));
         $w = $max;
      }
   }
   $text = "
      <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='$w' height='$h'>
         <param name=movie value='$url'>
         <param name=quality value=high>
         <embed src='$url' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='$w' height='$h'>
         </embed>
      </object>
      ";

   return $text;
}

function eplayerGetASX($url, $w, $h) {
   $text = "
      <object id='MediaPlayer1' width='$w' height='$h'
         classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95'
         codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
         standby='Loading Microsoft® Windows® Media Player components...'
         type='application/x-oleobject' align='middle'>
         <param name='uiMode' value='full' />
         <param name='FileName' value='$url'>
         <param name='ShowStatusBar' value='True'>
         <param name='DefaultFrame' value='mainFrame'>
         <param name='URL' value='$url' />
         <param name='autoStart' value='true' />
         <embed type='application/x-mplayer2' src='$url' id='nolplayer1' name='nolplayer1' ShowControls=1 ShowDisplay=0 AutoStart=1 ShowStatusBar=1 width='$w' height='$h'></embed>
      </object>
      ";
   return $text;
}

function eplayerGetRM($url, $w, $h) {
   return eplayerGetRAM($url, $w, $h);
}

function eplayerGetRPM($url, $w, $h) {
   return eplayerGetRAM($url, $w, $h);
}

function eplayerGetRAM($url, $w, $h) {
   $text = "
      <object id='nolplayer1' name='nolplayer1' classid='CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' width='$w' height='$h' border='0'>
         <param name='autostart' value='true'>
         <param name='src' value='$url'>
         <param name='controls' value='ImageWindow'>
         <param name='console' value='av'>
         <embed name='nolplayer' id='nolplayer' border='0' src='$url' width='$w' height='$h' autostart='true' controls='ImageWindow' console='av' type='audio/x-pn-realaudio-plugin'>
         </embed>
      </object>
      <br />
      <object id='nolplayer2' name='nolplayer2' classid='CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' width='$w' height='27' border='0'>
         <param name='autostart' value='true'>
         <param name='src' value='$url'>
         <param name='controls' value='StatusBar'>
         <param name='console' value='av'>
         <embed name='nolplayer2' id='nolplayer2' src='$url' width='$w' height='27' controls='StatusBar' console='av' type='audio/x-pn-realaudio-plugin'>
         </embed>
      </object>
      <br />
      <object id='nolplayer3' name='nolplayer3' classid='CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' width='$w' height='26' border='0'>
         <param name='autostart' value='true'>
         <param name='src' value='$url'>
         <param name='controls' value='ControlPanel'>
         <param name='console' value='av'>
         <embed name='nolplayer3' id='nolplayer3' src='$url' width='$w' height='26' controls='ControlPanel' console='av' type='audio/x-pn-realaudio-plugin'>
         </embed>
      </object>
      ";

   $text .= "<hr>
      <a href='$url'>".EPLAYER_LAN_33."</a>
      ";

   return $text;
}

function eplayerGetJPG($url, $w, $h) {
   return eplayerGetImage($url, $w, $h);
}

function eplayerGetJPEG($url, $w, $h) {
   return eplayerGetImage($url, $w, $h);
}

function eplayerGetPNG($url, $w, $h) {
   return eplayerGetImage($url, $w, $h);
}

function eplayerGetGIF($url, $w, $h) {
   return eplayerGetImage($url, $w, $h);
}

function eplayerGetImage($url, $w, $h) {
   global $pref;
   $size = getimagesize($url);
   $w = $size[0];
   $h = $size[1];
   if ($pref["eplayer_max_width"] != "") {
      $max = $pref["eplayer_max_width"];
      if ($w > $max) {
         $h = intval($h / ($w/$max));
         $w = $max;
      }
   }
   $text = "<a href='$url' target='_new'><img src='$url' width='$w' height='$h' border='0' /><br />".EPLAYER_LAN_34."</a>";
   if (function_exists(exif_read_data)) {
      $exif = exif_read_data($url, 0, true);
      if ($exif) {
         $text .= "<div onclick=expandit('eplayer_exif_info')>".EPLAYER_LAN_37;
         $text .= "<div id='eplayer_exif_info' class='forumheader3' style='display:none;'><table>";
         foreach ($exif as $key => $section) {
            //$text .= "<tr><th colspan='2'>$key</th></tr>";
            foreach ($section as $name => $val) {
               if ($val != NULL && strlen(trim($val)) > 0 && strtolower(substr($name, 0, 12)) != "undefinedtag") {
                  //pick out some specific attributes that can be displayed better
                  switch (strtolower($name)) {
                     case "filedatetime" :
                        $tmp = date("r", $val);
                        break;
                     case "filesize" :
                        $tmp = round(($val/1024), 2)." Kb";
                        break;
                     case "sectionsfound" :
                        // Don't display
                        $tmp = "";
                        break;
                     case "bitspersample" :
                        $tmp = implode("," , $val);
                        break;
                     default :
                        $tmp = $val;
                  }
                  if (strlen($tmp) > 0) {
                     $text .= "<tr><td>$name</td><td>$tmp</td></tr>";
                  }
               }
            }
         }
         $text .= "</table></div>";
      }
   }
   return $text;
}

// Handles, amongst others, MPG, MPEG, WMV
function eplayerGetDefault($url, $w, $h) {
   // Add height to allow for controls area
   $h += 69;
   $text = "
      <embed name='player' id='player'
         pluginspage='http://www.microsoft.com/windows/windowsmedia/download/'
         type='application/x-mplayer2'
         src='$url'
         width='$w'
         height='$h'
         ShowControls='1' ShowDisplay='0' ShowStatusBar='1' autostart='1' autorewind='0' ShowPositionControls='1' ShowTracker='1'>
      </embed>
   ";
   return $text;
}

function eplayerAdd($msg=false) {
   global $ns;

   $categorytable = "eplayer_category";

   $sql = new db();

   extract($_POST);

   if ($msg) {
      $ns->tablerender("", $msg);
   }

   $sql->db_Select($categorytable, "*", "order by cat_name asc", false);
   $selected = " selected";
   while ($ep_row = $sql->db_Fetch()) {
      extract($ep_row);
      $categories .= "$cat_id:$cat_name,";
   }
   $categories = substr($categories, 0, strlen($categories)-1);

   require_once("form_handler.php");
   $rs = new form;

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_03_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_03_2;
   $fieldname[] = "eplayer_filename[]";
   $fieldtype[] = "file";
   $fieldvalu[] = ",40,255";
   $fieldmand[] = "*";

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_02_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_02_1;
   $fieldname[] = "category";
   $fieldtype[] = "dropdown2";
   $fieldvalu[] = $categories;
   $fieldmand[] = "*";

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_00_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_00_1;
   $fieldname[] = "title";
   $fieldtype[] = "text";
   $fieldvalu[] = ",40,100";
   $fieldmand[] = "*";

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_01_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_01_1;
   $fieldname[] = "description";
   $fieldtype[] = "textarea";
   $fieldvalu[] = ",90%,100px";
   $fieldmand[] = "";

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_08_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_08_1;
   $fieldname[] = "datestamp";
   $fieldtype[] = "datestamp";
   $fieldvalu[] = "2000";
   $fieldmand[] = "";

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_14_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_14_1;
   $fieldname[] = "mediatype";
   $fieldtype[] = "dropdown2";
   $fieldvalu[] = "0:".EPLAYER_LAN_ADMIN_MEDIA_14_2.",1:".EPLAYER_LAN_ADMIN_MEDIA_14_3.",2:".EPLAYER_LAN_ADMIN_MEDIA_14_4;
   $fieldmand[] = "";

   $text .= "<form enctype='multipart/form-data' method='post' name='eplayer' action='".e_SELF."?submit'>";
   $text .= "<table class='fborder' style='width:100%'>";

   $text .= "<tr><td class='forumheader' colspan='2'>".EPLAYER_LAN_46."</td></tr>";

   for ($i=0; $i<count($fieldcapt); $i++) {
      $form_send = $fieldcapt[$i] . "|" .$fieldtype[$i]."|".$fieldvalu[$i];
      if ($fieldtype[$i] != "hidden") {
         $text .="<tr>
            <td style='vertical-align:top' class='forumheader2'>".$fieldcapt[$i]." ".$fieldmand[$i]."<br><span class='smalltext'>".$fieldnote[$i]."</td>
            <td class='forumheader2'>";
      }
      $text .= $rs->user_extended_element_edit($form_send, $row[$fieldname[$i]], $fieldname[$i]);
      if ($fieldtype[$i] != "hidden") {
         $text .="</td></tr>";
      }
   }

   $text .= "<tr><td class='forumheader2' style='text-align:center' colspan='2'><button class='' name='eplayersubmit' type='submit'>".EPLAYER_LAN_47."</button></td></tr>";
   $text .= "</table></form>";

   return $text;
}
?>

ViPHP
ViPHP | 4674 Messages

23 juil. 2007, 16:22

D'après moi, il n'y aurait aucun fichier qui serait susceptible de s'occuper de l'upload de tes fichiers dans tous les require_once présentés ci-dessus.
Sauf peut-être class2.php, mais nommer des fichiers comme ça est un peu bête ...

Il faut trouver l'endroit (fichier) où tu as le script de l'upload. Tu vas vite le reconnaître. Sinon fais une recherche de la chaîne : "move_uploaded_file" sur tous tes fichiers. C'est la fonction phare de PHP pour l'upload de fichiers :)
« Un handicap est le résultat d'une rencontre entre une déficience ou différence et une incapacité de la société à répondre à celle-ci. »

Hoa : http://hoa-project.net (sur @hoaproject).

Eléphanteau du PHP | 34 Messages

23 juil. 2007, 17:33

j'ai trouvé le fichier , je crois

// Check to see if we are uploading a file <)---// c'est ça
<?php
/*
+---------------------------------------------------------------+
| ePlayer by bugrain (www.bugrain.plus.com)
|
| A plugin for the e107 Website System (http://e107.org)
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: E:/cvs/cvsrepo/eplayer/eplayer.php,v $
| $Revision: 1.30 $
| $Date: 2005/10/09 16:26:04 $
| $Author: Neil $
+---------------------------------------------------------------+
*/
   require_once("../../class2.php");
   require_once(e_PLUGIN."eplayer/eplayer_variables.php");
   define("PAGE_NAME", $pref['eplayer_title']);
   require_once(e_HANDLER."comment_class.php");
   require_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_comment.php");

   $eplayertable  = "eplayer";
   $categorytable = "eplayer_category";

   $aj   = new textparse;
   $sql2 = new db;
   $con  = new convert;
   $cobj = new comment;

   $clipsPerPage = $pref['eplayer_clips_per_page'];

   if(!is_object($gen)){
      $gen = new convert;
   }

   require_once(HEADERF);

   $text = "<table class='fborder' width='100%'>";

   // No query so display category list
   if (!e_QUERY) {
      $sql->db_Select($categorytable, "*", "cat_parent_category=0 order by cat_display_order asc");
      $text .= "<tr><td colspan='4' class='forumheader'>".EPLAYER_LAN_01."</td></tr>";

      while (list($catid, $catname, $catdescription, $caticon, $catdisplay_order) = $sql->db_Fetch()) {
         $qry = "select * from ".MPREFIX."$eplayertable as e
                  left join ".MPREFIX."$categorytable as c on e.category = c.cat_id
                  where (e.category=$catid
                     or (e.category=c.cat_id and c.cat_parent_category=$catid))
                     and e.approved='0'
                     ";
         $count = $sql2->db_Select_gen($qry);
         $numsubcats = $sql2->db_Count($categorytable." where cat_parent_category='$catid' and approved='0'");
         $text .= "<tr><td class='forumheader3' style='text-align:center'>";
         if ($count) {
            $text .= "<a href='eplayer.php?cat.$catid.0.$clipsPerPage'><img src='$caticon' style='border:0px' /></a></td>
                     <td class='forumheader3'><a href='eplayer.php?cat.$catid.0.$clipsPerPage'>$catname</a>";
         } else if ($numsubcats) {
            $text .= "<a href='eplayer.php?cat.$catid.0.$clipsPerPage'><img src='$caticon' style='border:0px' /></a></td>
                     <td class='forumheader3'><a href='eplayer.php?cat.$catid.0.$clipsPerPage'>$catname</a>";
         } else {
            $text .= "<img src='$caticon' style='border:0px' /></td>
                     <td class='forumheader3'>$catname";
         }
         $sql2->db_Select($eplayertable, "timestamp", "category=$catid and approved='0' order by timestamp desc limit 0,1");
         list($timestamp) = $sql2->db_Fetch();

         $ts = $gen->convert_date($timestamp, "short");
         $text .= "<br /><span class='smalltext'>$catdescription</span></td>
                  <td class='forumheader3' style='text-align:center'>$count ".EPLAYER_LAN_14.", $numsubcats ".EPLAYER_LAN_32."<br />".EPLAYER_LAN_23." $ts</td></tr>";
      }
      $text .= "<tr><td class='forumheader3' style='text-align:right' colspan='3'>";
      $text .= "<form method='post' action='eplayer.php?search'>";
      if (USER) {
         $text .= "<div style='float:left;'><a href='".e_SELF."?upload'>[".EPLAYER_LAN_46."]</a></div>";
      }
      $text .= "<div style='float:right'><input class='tbox search' type='text' name='search' size='20' value='' maxlength='50' />&nbsp;";
      $text .= "<input class='button search' type='submit' name='s' value='".EPLAYER_LAN_44."' />";
      $text .= "</div></form>";
      $text .= "</td></tr>";
   }

   switch ($pref["eplayer_display_order"]) {
      case EPLAYER_LAN_ADMIN_PREF_03_3 : {
         $order = "datestamp asc, timestamp asc";
         break;
      }
      case EPLAYER_LAN_ADMIN_PREF_03_4 : {
         $order = "datestamp desc, timestamp desc";
         break;
      }
      case EPLAYER_LAN_ADMIN_PREF_03_5 : {
         $order = "timestamp asc, datestamp asc";
         break;
      }
      case EPLAYER_LAN_ADMIN_PREF_03_6 : {
         $order = "timestamp desc, datestamp desc";
         break;
      }
      default : {
         $order = "title ASC";
         break;
      }
   }

   // Check to see if we are uploading a file
   if (eregi("upload", e_QUERY)) {
      $text .= "<tr><td>";
      $text .= eplayerAdd();
      $text .= "</td></tr>";
   }

   // Check to see if we are uploading a file
   if (eregi("submit", e_QUERY)) {
      // Check for mandatory fields
      $eplayer_filename = $_FILES["eplayer_filename"];
      if (strlen($eplayer_filename["name"][0]) == 0) {
         $message .= EPLAYER_LAN_ADMIN_MEDIA_03_0." ".EPLAYER_LAN_ADMIN_MEDIA_12;
      }
      if (strlen($_POST['title']) == 0) {
         $message .= EPLAYER_LAN_ADMIN_MEDIA_00_0." ".EPLAYER_LAN_ADMIN_MEDIA_12;
      }
      if (strlen($message) > 0) {
         $text .= "<tr><td>";
         $text .= eplayerAdd($message);
         $text .= "</td></tr>";
      } else {
         if (is_uploaded_file($eplayer_filename['tmp_name'][0])) {
            if ($_POST["mediatype"] == 0) {
               $eplayer_dir = $pref["eplayer_image_dir"];
            } else {
               $eplayer_dir = $pref["eplayer_media_dir"];
            }
            $eplayer_file = e_FILE.$eplayer_dir."/".ereg_replace("[^a-z0-9._]", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($eplayer_filename['name'][0]))));
            if (move_uploaded_file($eplayer_filename['tmp_name'][0], $eplayer_file)) {
               $query = "0, ";                              // id
               $query .= "'".$eplayer_file."', ";           // filename
               $query .= "'".$_POST["title"]."', ";         // title
               $query .= "'".$_POST["category"]."', ";      // category
               $datestamp = mktime (0,0,0,$_POST["datestamp_month"],$_POST["datestamp_day"],$_POST["datestamp_year"]);
               $query .= $datestamp.", ";                   // datestamp
               $query .= "'".$_POST["description"]."', ";   // description
               $query .= "'', ";                            // icon
               $query .= "0, ";                             // width
               $query .= "0, ";                             // height
               $query .= "'".USERNAME."', ";                // author
               $query .= "1, ";                             // comment
               $query .= time().", ";                       // timestamp
               $query .= "0, ";                             // lastview
               $query .= "0, ";                             // viewcount
               $query .= "1 ";                              // approved
               if ($sql2->db_Insert("eplayer", $query)) {
                  $text .= "<tr><td>";
                  $text .= eplayerAdd(EPLAYER_LAN_49);
                  $text .= "</td></tr>";
               } else {
                  print mysql_error();
                  $text .= "<tr><td>";
                  $text .= eplayerAdd(EPLAYER_LAN_48);
                  $text .= "</td></tr>";
               }
            } else {
               $text .= "<tr><td>";
               $text .= eplayerAdd(EPLAYER_LAN_48);
               $text .= "</td></tr>";
            }
         } else {
            print mysql_error();
            $text .= "<tr><td>";
            $text .= eplayerAdd(EPLAYER_LAN_48);
            $text .= "</td></tr>";
         }
      }
   }

   // Check to see if we are searching
   if (eregi("search", e_QUERY)) {
      $tmp     = explode(".", e_QUERY);

      $sql2->db_Select($categorytable, "*", "cat_id='$catid'");
      list($catid, $catname, $catdescription, $caticon, $catorder, $catparent) = $sql2->db_Fetch();
      $qry = "select * from ".MPREFIX."$eplayertable as e
               left join ".MPREFIX."$categorytable as c on e.category = c.cat_id
               where (e.category=$catid
                  or (e.category=c.cat_id and c.cat_parent_category=$catid))
                  and e.approved='0'
                  ";
      $count = $sql2->db_Select_gen($qry);
      $numsubcats = $sql2->db_Count($categorytable." where cat_parent_category='$catid' and approved='0'");
      $text .= "<tr><td colspan='3' class='np' style='text-align:left'><a href='eplayer.php'><< ".EPLAYER_LAN_22." ".EPLAYER_LAN_01."</a></td></tr>";
      if ($catparent) {
         $sql2->db_Select($categorytable, "*", "cat_id='$catparent'");
         if ($tmp = $sql2->db_Fetch()) {
            $text .= "<tr><td colspan='3' class='np' style='text-align:left'><a href='eplayer.php?cat.$catparent.0.$clipsPerPage'><< ".EPLAYER_LAN_22." ".$tmp['cat_name']."</a></td></tr>";
         }
      }
      $text .= "<tr><td colspan='2' class='forumheader' width='66%'>$catname<br /><span class='smalltext'>$catdescription</span></td>";
      $text .= "<td class='forumheader' style='text-align:center'>";
      $text .= "<span class='smallblacktext'>$count ".EPLAYER_LAN_14."</span>";
      $text .= "</td></tr>";

      $count = $sql->db_Count($eplayertable." WHERE category='$catid' and approved='0'");
      $search = $_POST["search"];
      if ($sql->db_Select($eplayertable, "*", "(title like '%$search%' OR description like '%$search%') and approved='0' ORDER BY $order", true)) {
         $text .= "<tr><td colspan='4' class='forumheader2'>".EPLAYER_LAN_27."</td></tr>";
         while ($row = $sql->db_Fetch()) {
            extract($row);
            $title         = $aj->tpa($title);
            $description   = $aj->tpa($description);

            $text .= "<td class='forumheader3' style='text-align:center'><a href='eplayer.php?view.$id.0.$clipsPerPage'><img src='$icon' style='border:0px' /></a></td>
                     <td class='forumheader3'><a href='eplayer.php?view.$id.0.$clipsPerPage'>$title</a><br />$description</td>
                     <td class='forumheader3' style='text-align:center'>".EPLAYER_LAN_21."$author";
            if ($datestamp > 0) {
               $date = $gen->convert_date($datestamp, "short");
               $text .= "<br />$date";
            }
            if ($timestamp > 0) {
               $date = $gen->convert_date($timestamp, "short");
               $text .= "<br />".EPLAYER_LAN_24.": $date";
            }
               $text .= "<br />".EPLAYER_LAN_41.": $viewcount";
            if ($lastview > 0) {
               $text .= "<br />".EPLAYER_LAN_42.": ".$gen->convert_date($lastview, "short");
            } else {
               $text .= "<br />".EPLAYER_LAN_43;
            }
            $text .= "</td></tr>";
         }
      } else {
         $text .= "<tr><td class='forumheader3' colspan='3'>".EPLAYER_LAN_45."</td></tr>";
      }

      $text .= "<tr><td class='forumheader3' style='text-align:right' colspan='3'>";
      $text .= "<form method='post' action='eplayer.php?search'>";
      $text .= "<input class='tbox search' type='text' name='search' size='20' value='$search' maxlength='50' />&nbsp;";
      $text .= "<input class='button search' type='submit' name='s' value='".EPLAYER_LAN_44."' />";
      $text .= "</form>";
      $text .= "</td></tr>";
   }

   // Check to see if we should be displaying clips in a category
   if (eregi("cat.", e_QUERY)) {
      $tmp     = explode(".", e_QUERY);
      $catid   = $tmp[1];
      $from    = $tmp[2];
      $view    = $tmp[3];

      $sql2->db_Select($categorytable, "*", "cat_id='$catid'");
      list($catid, $catname, $catdescription, $caticon, $catorder, $catparent) = $sql2->db_Fetch();
      $qry = "select * from ".MPREFIX."$eplayertable as e
               left join ".MPREFIX."$categorytable as c on e.category = c.cat_id
               where (e.category=$catid
                  or (e.category=c.cat_id and c.cat_parent_category=$catid))
                  and e.approved='0'
                  ";
      $count = $sql2->db_Select_gen($qry);
      $numsubcats = $sql2->db_Count($categorytable." where cat_parent_category='$catid' and approved='0'");
      $text .= "<tr><td colspan='3' class='np' style='text-align:left'><a href='eplayer.php'><< ".EPLAYER_LAN_22." ".EPLAYER_LAN_01."</a></td></tr>";
      if ($catparent) {
         $sql2->db_Select($categorytable, "*", "cat_id='$catparent'");
         if ($tmp = $sql2->db_Fetch()) {
            $text .= "<tr><td colspan='3' class='np' style='text-align:left'><a href='eplayer.php?cat.$catparent.0.$clipsPerPage'><< ".EPLAYER_LAN_22." ".$tmp['cat_name']."</a></td></tr>";
         }
      }
      $text .= "<tr><td colspan='2' class='forumheader' width='66%'>$catname<br /><span class='smalltext'>$catdescription</span></td>";
      $text .= "<td class='forumheader' style='text-align:center'>";
      $text .= "<span class='smallblacktext'>$count ".EPLAYER_LAN_14."</span>";
      $text .= "</td></tr>";

      // Displaying a category - check for sub-categories first
      $sql->db_Select($categorytable, "*", "cat_parent_category=$catid order by cat_display_order asc", true);

      if ($numsubcats > 0) {
         $text .= "<tr><td colspan='4' class='forumheader2'>".EPLAYER_LAN_26."</td></tr>";
      }

      while (list($parentcatid, $catname, $catdescription, $caticon, $catdisplay_order) = $sql->db_Fetch()) {
         $count = $sql2->db_Select($eplayertable, "*", "category=$parentcatid and approved='0' order by timestamp desc");

         $text .= "<tr><td class='forumheader3' style='text-align:center'>";
         if ($count) {
            $text .= "<a href='eplayer.php?cat.$catid.0.$clipsPerPage'><img src='$caticon' style='border:0px' /></a></td>
                     <td class='forumheader3'><a href='eplayer.php?cat.$parentcatid.0.$clipsPerPage'>$catname</a>";
         } else {
            $text .= "<img src='$caticon' style='border:0px' /></td>
                     <td class='forumheader3'>$catname";
         }

         list($eid, $filename, $title, $category, $datestamp, $description, $icon, $width, $height, $author, $comment, $timestamp) = $sql2->db_Fetch();

         $ts = $gen->convert_date($timestamp, "short");
         $text .= "<br /><span class='smalltext'>$catdescription</span></td>
                  <td class='forumheader3' style='text-align:center'>$count ".EPLAYER_LAN_14."<br />".EPLAYER_LAN_23." $ts</td></tr>";
      }

      $count = $sql->db_Count($eplayertable." WHERE category='$catid' and approved='0'");
      if ($sql->db_Select($eplayertable, "*", "category='$catid' and approved='0' ORDER BY $order LIMIT $from,$view", true)) {
         $text .= "<tr><td colspan='4' class='forumheader2'>".EPLAYER_LAN_27."</td></tr>";
         while ($row = $sql->db_Fetch()) {
            extract($row);
            $title         = $aj->tpa($title);
            $description   = $aj->tpa($description);

            $text .= "<td class='forumheader3' style='text-align:center'><a href='eplayer.php?view.$id.0.$clipsPerPage'><img src='$icon' style='border:0px' /></a></td>
                     <td class='forumheader3'><a href='eplayer.php?view.$id.0.$clipsPerPage'>$title</a><br />$description</td>
                     <td class='forumheader3' style='text-align:center'>".EPLAYER_LAN_21."$author";
            if ($datestamp > 0) {
               $date = $gen->convert_date($datestamp, "short");
               $text .= "<br />$date";
            }
            if ($timestamp > 0) {
               $date = $gen->convert_date($timestamp, "short");
               $text .= "<br />".EPLAYER_LAN_24.": $date";
            }
               $text .= "<br />".EPLAYER_LAN_41.": $viewcount";
            if ($lastview > 0) {
               $text .= "<br />".EPLAYER_LAN_42.": ".$gen->convert_date($lastview, "short");
            } else {
               $text .= "<br />".EPLAYER_LAN_43;
            }
            $text .= "</td></tr>";
         }
      }

      $text .= "<tr><td colspan='3'>";
      $text .= eplayerPaging($from, $view, $count, "cat.$catid");
      $text .= "</tr>";
   }

   // Check to see if we are playing a clip
   if (eregi("view.", e_QUERY)) {
      $tmp  = explode(".", e_QUERY);
      $id   = $tmp[1];
      $from = $tmp[2];
      $view = $tmp[3];

      // Check if we are posting comments
      if (isset($_POST['commentsubmit'])) {
         if (!$sql->db_Select("eplayer", "comment", "id = '{$id}'")) {
            header("location:".e_BASE."index.php");
            exit;
         } else {
            $row = $sql->db_Fetch();
            if ($row[0] && (ANON === TRUE || USER === TRUE)) {
               $cobj->enter_comment($_POST['author_name'], $_POST['comment'], "eplayer", $id, $pid, $_POST['subject']);
               if($pref['cachestatus']){
                  $e107cache->clear("comment.eplayer.{$sub_action}");
               }
            }
         }
      }

      $sql->db_Select($eplayertable, "*", "id='$id'");
      list($id, $filename, $title, $category, $datestamp, $description, $icon, $width, $height, $author, $comment, $timestamp, $lastview, $viewcount) = $sql->db_Fetch();

      // Increment view count
		$sql->db_Update($eplayertable, "lastview=".time().", viewcount=viewcount+1 WHERE id='$id'");

      $title       = $aj->tpa($title);
      $description = $aj->tpa($description);

      $sql2->db_Select($categorytable, "*", "cat_id='$category'");
      list($catid, $catname) = $sql2->db_Fetch();

      $text .= "<tr><td colspan='2' class='np' style='text-align:left'><a href='eplayer.php?cat.$catid.0.$clipsPerPage'><< ".EPLAYER_LAN_22." $catname</a></td></tr>";

      $text2 .= "<tr><td class='forumheader3' width='66%'><img src='".e_IMAGE.$pref["eplayer_icon_dir"]."/$icon' style='border:0px' align='middle' />";
      $text2 .= "&nbsp;$title<br /><span class='smalltext'>$description</span></td>";
      $text2 .= "<td class='forumheader3'>$author";
      if ($datestamp > 0) {
         $date = $gen->convert_date($datestamp, "short");
         $text2 .= "<br /><span class='smalltext'>$date</span>";
      }
      if ($timestamp > 0) {
         $date = $gen->convert_date($timestamp, "short");
         $text2 .= "<br /><span class='smalltext'>".EPLAYER_LAN_24.": $date</span>";
      }
      $text2 .= "</td></tr>";

      if ($pref['eplayer_show_clip_details'] == EPLAYER_LAN_ADMIN_PREF_06_2) {
         $text .= $text2;
      }

      $text .= "<tr><td colspan='2' class='forumtable2' style='text-align:center;'>";
      $mediaFunc = "eplayerGet".strtoupper(substr($filename, strrpos($filename, ".")+1));
      if(!function_exists($mediaFunc)) {
         $mediaFunc = "eplayerGetDefault";
      }
      $text .= call_user_func($mediaFunc, $filename, $width, $height);
      $text .= "</td></tr>";

      if ($comment == "1" && !$ep_e107v7) {
         $query = $pref['nested_comments'] ?
            "comment_item_id='$id' AND comment_type='$eplayertable' AND comment_pid='0' ORDER BY comment_datestamp" :
            "comment_item_id='$id' AND comment_type='$eplayertable' ORDER BY comment_datestamp";
         unset($text3);
         $sql2 = new db;
         if ($comment_total = $sql2->db_Select("comments", "*",  $query)) {
            $width = 0;
            while($row = $sql2->db_Fetch()) {
               // ** Need to sort out how to do nested comments here, see "" ($action), and ratings (broken in e107 CVS?)
               if ($pref['nested_comments']) {
                  $text3 .= $cobj->render_comment($row, $eplayertable, "comment", $id, $width, $subject, true);
               } else {
                  $text3 .= $cobj->render_comment($row, $eplayertable, "comment", $id, $width, $subject, true);
               }
            }
            if (ADMIN && getperms("B")) {
               $text3 .= "<div style='text-align:right'><a href='".e_ADMIN."modcomment.php?eplayer.$id'>".LAN_314."</a></div>";
            }
         }
      }

      $next = $prev = $lastid = 0;
      if ($sql->db_Select($eplayertable, "*", "category='$catid' and approved='0' ORDER BY $order", true)) {
         while ($row = $sql->db_Fetch()) {
            if ($row['id'] == $id) {
               $prev = $lastid;
               break;
            }
            $lastid = $row['id'];
         }
         if ($row = $sql->db_Fetch()) {
            $next = $row['id'];
         }
      }
      $text .= "<tr><td colspan='2'>";
      if ($prev > 0) {
         $text .= "<div class='smalltext' style='float:left'><a href='$PHP_SELF?view.$prev.$from.$view'><< ".EPLAYER_LAN_38."</a></div>";
      }
      if ($next > 0) {
         $text .= "<div class='smalltext' style='float:right'><a href='$PHP_SELF?view.$next.$from.$view'>".EPLAYER_LAN_39." >></a></div>";
      }
      $text .= "</td></tr>";

      if ($pref['eplayer_show_clip_details'] == EPLAYER_LAN_ADMIN_PREF_06_3) {
         $text .= $text2;
      }

      require_once(e_HANDLER."rate_class.php");
      $rater = new rater;
      $text .= "<tr><td colspan='2' style='text-align:right'>";
      if ($ratearray = $rater->getrating("eplayer", $id)) {
         for($c = 1; $c <= $ratearray[1]; $c++) {
            $text .= "<img src='".e_IMAGE."rate/".IMODE."/star.png' alt='' />";
         }
         if ($ratearray[2]) {
            $text .= "<img src='".e_IMAGE."rate/".IMODE."/".$ratearray[2].".png'  alt='' />";
         }
         if ($ratearray[2] == "") {
            $ratearray[2] = 0;
         }
         $text .= "&nbsp;".$ratearray[1].".".$ratearray[2]." - ".$ratearray[0]."&nbsp;";
         $text .= ($ratearray[0] == 1 ? RATELAN_0 : RATELAN_1);
      } else {
         $text .= RATELAN_4;
      }

      if (!$rater->checkrated("eplayer", $id) && USER) {
         $ratetext = $rater->rateselect("&nbsp;&nbsp;&nbsp;&nbsp;<b>".RATELAN_2, "eplayer", $id)."</b>";
         if (!$ep_e107v7) {
            $ratetext = str_replace("rate.php", "../../rate.php", $ratetext);
         }
         $text .= $ratetext;
      } else if(!USER) {
         $text .= "&nbsp;";
      } else {
         $text .= "&nbsp;-&nbsp;".RATELAN_3;
      }
      $text .= "</td></tr>";
   }

   $text .= "</table>";
   $ns->tablerender($pref['eplayer_title'], $text);
   if ((eregi("view.", e_QUERY)) && ($comment == "1")) {
      // e107 0.617
      if (!$ep_e107v7) {
         if (strlen($text3) > 0) {
            $ns->tablerender(LAN_5, $text3);
         }
         $cobj->form_comment("comment", "eplayer", $id, $subject, $content_type);
      } else {
         // e107 0.7
         $cobj->compose_comment("eplayer", "comment", $id, $width, $subject, $showrate=false);
      }
   }

   require_once(FOOTERF);
   exit;

function eplayerPaging($from, $view, $total, $qs) {
   if ($total == 0) {
      return;
   }

   $text = "<table width='100%'><tr>";
   $text .= "<td style='width:25%;text-align:left' class='np'>";
   if ($from > 0) {
      $s = $from - $view;
      $text .= "<span class='smalltext'><a href='$PHP_SELF?$qs.$s.$view'><&nbsp;".EPLAYER_LAN_16."</a></span></div>";
   }

   $start  = $from + 1;
   $finish = $from + $view;

   if ($finish > $total) {
      $finish = $total;
   }

   $text .= "&nbsp;</td><td style='width:50%;text-align:center' class='np'>";
   $text .= "<span class='smallblacktext'>".EPLAYER_LAN_18." $start ".EPLAYER_LAN_19." $finish ".EPLAYER_LAN_20." $total</span></td>";

   $s = $from + $view;
   $text .= "<td style='width:25%;text-align:right' class='np'>&nbsp;";
   if ($s < $total) {
      $text .= "<span class='smalltext'><a href='$PHP_SELF?$qs.$s.$view'>".EPLAYER_LAN_17."&nbsp;></a>&nbsp;</span></td>";
   }

   $text .= "</tr></table>";
   return $text;
}

function eplayerGetMOV($url, $w, $h) {
   // Add height to allow for controls area
   $h += 18;
   $text = "
      <object classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab' width='$w' height='$h'>
         <param name='src' value='$url'>
         <param name='autoplay' value='true'>
         <param name='controller' value='true'>
         <embed src='$url' width='$w' height='$h' autoplay='true' controller='true' pluginspage='http://www.apple.com/quicktime/download/'>
         </embed>
      </object>
      ";
   return $text;
}

function eplayerGetSWF($url, $w, $h) {
   global $pref;
   $size = getimagesize($url);
   $w = $size[0];
   $h = $size[1];
   if ($pref["eplayer_max_width"] != "") {
      $max = $pref["eplayer_max_width"];
      if ($w > $max) {
         $h = intval($h / ($w/$max));
         $w = $max;
      }
   }
   $text = "
      <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='$w' height='$h'>
         <param name=movie value='$url'>
         <param name=quality value=high>
         <embed src='$url' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='$w' height='$h'>
         </embed>
      </object>
      ";

   return $text;
}

function eplayerGetASX($url, $w, $h) {
   $text = "
      <object id='MediaPlayer1' width='$w' height='$h'
         classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95'
         codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
         standby='Loading Microsoft® Windows® Media Player components...'
         type='application/x-oleobject' align='middle'>
         <param name='uiMode' value='full' />
         <param name='FileName' value='$url'>
         <param name='ShowStatusBar' value='True'>
         <param name='DefaultFrame' value='mainFrame'>
         <param name='URL' value='$url' />
         <param name='autoStart' value='true' />
         <embed type='application/x-mplayer2' src='$url' id='nolplayer1' name='nolplayer1' ShowControls=1 ShowDisplay=0 AutoStart=1 ShowStatusBar=1 width='$w' height='$h'></embed>
      </object>
      ";
   return $text;
}

function eplayerGetRM($url, $w, $h) {
   return eplayerGetRAM($url, $w, $h);
}

function eplayerGetRPM($url, $w, $h) {
   return eplayerGetRAM($url, $w, $h);
}

function eplayerGetRAM($url, $w, $h) {
   $text = "
      <object id='nolplayer1' name='nolplayer1' classid='CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' width='$w' height='$h' border='0'>
         <param name='autostart' value='true'>
         <param name='src' value='$url'>
         <param name='controls' value='ImageWindow'>
         <param name='console' value='av'>
         <embed name='nolplayer' id='nolplayer' border='0' src='$url' width='$w' height='$h' autostart='true' controls='ImageWindow' console='av' type='audio/x-pn-realaudio-plugin'>
         </embed>
      </object>
      <br />
      <object id='nolplayer2' name='nolplayer2' classid='CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' width='$w' height='27' border='0'>
         <param name='autostart' value='true'>
         <param name='src' value='$url'>
         <param name='controls' value='StatusBar'>
         <param name='console' value='av'>
         <embed name='nolplayer2' id='nolplayer2' src='$url' width='$w' height='27' controls='StatusBar' console='av' type='audio/x-pn-realaudio-plugin'>
         </embed>
      </object>
      <br />
      <object id='nolplayer3' name='nolplayer3' classid='CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' width='$w' height='26' border='0'>
         <param name='autostart' value='true'>
         <param name='src' value='$url'>
         <param name='controls' value='ControlPanel'>
         <param name='console' value='av'>
         <embed name='nolplayer3' id='nolplayer3' src='$url' width='$w' height='26' controls='ControlPanel' console='av' type='audio/x-pn-realaudio-plugin'>
         </embed>
      </object>
      ";

   $text .= "<hr>
      <a href='$url'>".EPLAYER_LAN_33."</a>
      ";

   return $text;
}

function eplayerGetJPG($url, $w, $h) {
   return eplayerGetImage($url, $w, $h);
}

function eplayerGetJPEG($url, $w, $h) {
   return eplayerGetImage($url, $w, $h);
}

function eplayerGetPNG($url, $w, $h) {
   return eplayerGetImage($url, $w, $h);
}

function eplayerGetGIF($url, $w, $h) {
   return eplayerGetImage($url, $w, $h);
}

function eplayerGetImage($url, $w, $h) {
   global $pref;
   $size = getimagesize($url);
   $w = $size[0];
   $h = $size[1];
   if ($pref["eplayer_max_width"] != "") {
      $max = $pref["eplayer_max_width"];
      if ($w > $max) {
         $h = intval($h / ($w/$max));
         $w = $max;
      }
   }
   $text = "<a href='$url' target='_new'><img src='$url' width='$w' height='$h' border='0' /><br />".EPLAYER_LAN_34."</a>";
   if (function_exists(exif_read_data)) {
      $exif = exif_read_data($url, 0, true);
      if ($exif) {
         $text .= "<div onclick=expandit('eplayer_exif_info')>".EPLAYER_LAN_37;
         $text .= "<div id='eplayer_exif_info' class='forumheader3' style='display:none;'><table>";
         foreach ($exif as $key => $section) {
            //$text .= "<tr><th colspan='2'>$key</th></tr>";
            foreach ($section as $name => $val) {
               if ($val != NULL && strlen(trim($val)) > 0 && strtolower(substr($name, 0, 12)) != "undefinedtag") {
                  //pick out some specific attributes that can be displayed better
                  switch (strtolower($name)) {
                     case "filedatetime" :
                        $tmp = date("r", $val);
                        break;
                     case "filesize" :
                        $tmp = round(($val/1024), 2)." Kb";
                        break;
                     case "sectionsfound" :
                        // Don't display
                        $tmp = "";
                        break;
                     case "bitspersample" :
                        $tmp = implode("," , $val);
                        break;
                     default :
                        $tmp = $val;
                  }
                  if (strlen($tmp) > 0) {
                     $text .= "<tr><td>$name</td><td>$tmp</td></tr>";
                  }
               }
            }
         }
         $text .= "</table></div>";
      }
   }
   return $text;
}

// Handles, amongst others, MPG, MPEG, WMV
function eplayerGetDefault($url, $w, $h) {
   // Add height to allow for controls area
   $h += 69;
   $text = "
      <embed name='player' id='player'
         pluginspage='http://www.microsoft.com/windows/windowsmedia/download/'
         type='application/x-mplayer2'
         src='$url'
         width='$w'
         height='$h'
         ShowControls='1' ShowDisplay='0' ShowStatusBar='1' autostart='1' autorewind='0' ShowPositionControls='1' ShowTracker='1'>
      </embed>
   ";
   return $text;
}

function eplayerAdd($msg=false) {
   global $ns;

   $categorytable = "eplayer_category";

   $sql = new db();

   extract($_POST);

   if ($msg) {
      $ns->tablerender("", $msg);
   }

   $sql->db_Select($categorytable, "*", "order by cat_name asc", false);
   $selected = " selected";
   while ($ep_row = $sql->db_Fetch()) {
      extract($ep_row);
      $categories .= "$cat_id:$cat_name,";
   }
   $categories = substr($categories, 0, strlen($categories)-1);

   require_once("form_handler.php");
   $rs = new form;

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_03_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_03_2;
   $fieldname[] = "eplayer_filename[]";
   $fieldtype[] = "file";
   $fieldvalu[] = ",40,255";
   $fieldmand[] = "*";

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_02_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_02_1;
   $fieldname[] = "category";
   $fieldtype[] = "dropdown2";
   $fieldvalu[] = $categories;
   $fieldmand[] = "*";

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_00_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_00_1;
   $fieldname[] = "title";
   $fieldtype[] = "text";
   $fieldvalu[] = ",40,100";
   $fieldmand[] = "*";

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_01_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_01_1;
   $fieldname[] = "description";
   $fieldtype[] = "textarea";
   $fieldvalu[] = ",90%,100px";
   $fieldmand[] = "";

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_08_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_08_1;
   $fieldname[] = "datestamp";
   $fieldtype[] = "datestamp";
   $fieldvalu[] = "2000";
   $fieldmand[] = "";

   $fieldcapt[] = EPLAYER_LAN_ADMIN_MEDIA_14_0;
   $fieldnote[] = EPLAYER_LAN_ADMIN_MEDIA_14_1;
   $fieldname[] = "mediatype";
   $fieldtype[] = "dropdown2";
   $fieldvalu[] = "0:".EPLAYER_LAN_ADMIN_MEDIA_14_2.",1:".EPLAYER_LAN_ADMIN_MEDIA_14_3.",2:".EPLAYER_LAN_ADMIN_MEDIA_14_4;
   $fieldmand[] = "";

   $text .= "<form enctype='multipart/form-data' method='post' name='eplayer' action='".e_SELF."?submit'>";
   $text .= "<table class='fborder' style='width:100%'>";

   $text .= "<tr><td class='forumheader' colspan='2'>".EPLAYER_LAN_46."</td></tr>";

   for ($i=0; $i<count($fieldcapt); $i++) {
      $form_send = $fieldcapt[$i] . "|" .$fieldtype[$i]."|".$fieldvalu[$i];
      if ($fieldtype[$i] != "hidden") {
         $text .="<tr>
            <td style='vertical-align:top' class='forumheader2'>".$fieldcapt[$i]." ".$fieldmand[$i]."<br><span class='smalltext'>".$fieldnote[$i]."</td>
            <td class='forumheader2'>";
      }
      $text .= $rs->user_extended_element_edit($form_send, $row[$fieldname[$i]], $fieldname[$i]);
      if ($fieldtype[$i] != "hidden") {
         $text .="</td></tr>";
      }
   }

   $text .= "<tr><td class='forumheader2' style='text-align:center' colspan='2'><button class='' name='eplayersubmit' type='submit'>".EPLAYER_LAN_47."</button></td></tr>";
   $text .= "</table></form>";

   return $text;
}
?>

ViPHP
ViPHP | 4674 Messages

23 juil. 2007, 18:04

Lol pardon j'avais pas vu l'ascenseur sur le côté de ton code :P

Mais tu as dû trouver l'endroit, plus précisement. Lignes 129 à 174.
On voit à la ligne 136 :
if (move_uploaded_file($eplayer_filename['tmp_name'][0], $eplayer_file))
On voit qu'il ne traite que le premier fichier ([0]). Le contenu du bloc if enregistre dans la table le chemin vers le fichier, la date d'upload etc. Mais l'upload se fait dans la condition du if, nous sommes d'accord.

Ce que tu peux faire pour uploader plusieurs fichiers, c'est le faire avec une boucle.
for($i = 0, $max = count($_FILES["eplayer_filename"]); $i < $max; $i++) {
    // ligne 116, à 175.
}
Normalement, ça devrait fonctionner. Il faut revoir l'affichage du code HTML qui ne serait peut être pas bon. A vérifier.
Modifié en dernier par Hywan le 25 juil. 2007, 19:25, modifié 1 fois.
« Un handicap est le résultat d'une rencontre entre une déficience ou différence et une incapacité de la société à répondre à celle-ci. »

Hoa : http://hoa-project.net (sur @hoaproject).

Eléphanteau du PHP | 34 Messages

23 juil. 2007, 18:24

j'ai trouvé la ligne
if (move_uploaded_file($eplayer_filename['tmp_name'][0], $eplayer_file))
la boucle je la pose entre quoi
for($i = 0, $max = count($_FILES["eplayer_filename"]); $i < $max, $i++) {
// ligne 116, à 175.
}
j'ajoute un champ dans la base de donnée

id int(10) UNSIGNED Non auto_increment
filename varchar(200) latin1_swedish_ci Non

car dans la table il y a un champ filename

title varchar(100) latin1_swedish_ci Non
category int(10) UNSIGNED Non 0
datestamp int(10) UNSIGNED Non 0
description text latin1_swedish_ci Non
icon varchar(100) latin1_swedish_ci Non
width int(10) UNSIGNED Non 0
height int(10) UNSIGNED Non 0
author varchar(100) latin1_swedish_ci Non
comment tinyint(3) Non 1
timestamp int(19) UNSIGNED Non 0
lastview int(10) UNSIGNED Non 0
viewcount int(10) UNSIGNED Non 0
approved char(1)

ViPHP
ViPHP | 4674 Messages

23 juil. 2007, 18:58

La boucle qu'ouvre les lignes 116 à 175, comme marqué en commentaire. Mais ce n'est qu'une piste. Tu dois remplacer tous les [0] par [$i] évidemment. Je ne te fais pas ton script, je t'oriente vers la solution.
« Un handicap est le résultat d'une rencontre entre une déficience ou différence et une incapacité de la société à répondre à celle-ci. »

Hoa : http://hoa-project.net (sur @hoaproject).

Eléphanteau du PHP | 34 Messages

23 juil. 2007, 19:10

donne moi une plus grande piste (exemple un aeroport stp ) , je suis débutant je flanche , je m'éparpille , je ne vois pas tous les changements merci pour ton aide

ViPHP
ViPHP | 4674 Messages

24 juil. 2007, 10:43

Tu sais faire une boucle ?
En commentaire j'ai mis : ligne 116 à 175, il faut comprendre (et je pensais que c'était clair, dis moi si non) que la boucle encadre les lignes 116 à 175.

La boucle va servir à traiter les fichiers de 0 à $max (par l'intermédiaire de $i). Pour l'instant, on a un traitement mais que sur 0. Tu as compris ça ? 0 correspond à 1 seul fichier. Nous on veut en traiter plusieurs, donc on va utiliser une boucle pour parcourir tout le tableau des fichiers ($_FILES). Fais un print_r($_FILES); pour avoir une meilleure idée de la forme du tableau.

Le code actuel ne traite que l'index 0 de ce tableau, si on remplace cet index par $i, et qu'on place tout le code dans la boucle for de mon message précédent, il traitera tout le tableau. Si et seulement si le code est bien conçu. Mais le tableau $_FILES ne requière pas trop de bidouilles. Et au premier coup d'oeil, tu ne devrais pas avoir de soucis.

Je te mets sur la piste, le tableau $_FILES est reporté dans la variable $eplayer_filename.

Je pense que tu as suffisament d'éléments pour commencer (et finir ? ;))
« Un handicap est le résultat d'une rencontre entre une déficience ou différence et une incapacité de la société à répondre à celle-ci. »

Hoa : http://hoa-project.net (sur @hoaproject).

Eléphanteau du PHP | 34 Messages

25 juil. 2007, 07:45

j'ai bien compris ce que tu viens de me dire pour la boucle
j'ai essayé de l'insérer dans le code la page à la ligne 116 et l'accolade ligne 176 et aussi à la 136 l'accolade toujour à ligne 176
ça marche pas et j'ai une erreur de type
Parse error: parse error, expecting `';'' in c:\program files\easyphp1-8\www\e107_v0.7.8_full 1\e107_plugins\eplayer\eplayer.php on line 138

je ne sais pas faire print_r

tes explication sont bien c'est moi qui comprend pas merci

ViPHP
ViPHP | 4674 Messages

25 juil. 2007, 10:41

Tu risques de rencontrer cette erreur assez souvent. C'est une erreur de syntaxe : tu as oublié de mettre un ; (point virgule) à la fin de ta ligne 138, ou sinon sur 1 ou 2 lignes avant, regardes bien.

Et pour print_r, c'est simple :
print_r($ton_tableau);
N'hésites pas à regarder la documentation pour print_r, mais aussi pour le reste !
« Un handicap est le résultat d'une rencontre entre une déficience ou différence et une incapacité de la société à répondre à celle-ci. »

Hoa : http://hoa-project.net (sur @hoaproject).