| |
|
Voir le sujet précédent :: Voir le sujet suivant
|
| Auteur |
Message |
| |
|
virginie2 Nouveau WRInaute
Inscrit le: 27 Oct 2006 Messages: 15
|
Posté le : Dim Juil 22, 2007 14:35 Sujet du message: modifier un plugin de mon portail |
|
|
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
voici deux fichier sur 22
4 fichier sont appelés
form_handler.php
| Code: |
<?php
/*
+---------------------------------------------------------------+
| e107 website system
| Cameron's Plugin-Maker Form Handler.
| For the e107 CMS system originally by
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| Updated by bugrain, (neil@bugrain.plus.com) 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." ";
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." ";
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;
?>
|
eplayer.php
| Code: |
<?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' /> ";
$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' /> ";
$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 .= " $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 .= " ".$ratearray[1].".".$ratearray[2]." - ".$ratearray[0]." ";
$text .= ($ratearray[0] == 1 ? RATELAN_0 : RATELAN_1);
} else {
$text .= RATELAN_4;
}
if (!$rater->checkrated("eplayer", $id) && USER) {
$ratetext = $rater->rateselect(" <b>".RATELAN_2, "eplayer", $id)."</b>";
if (!$ep_e107v7) {
$ratetext = str_replace("rate.php", "../../rate.php", $ratetext);
}
$text .= $ratetext;
} else if(!USER) {
$text .= " ";
} else {
$text .= " - ".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'>< ".EPLAYER_LAN_16."</a></span></div>";
}
$start = $from + 1;
$finish = $from + $view;
if ($finish > $total) {
$finish = $total;
}
$text .= " </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'> ";
if ($s < $total) {
$text .= "<span class='smalltext'><a href='$PHP_SELF?$qs.$s.$view'>".EPLAYER_LAN_17." ></a> </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
|
Dernière édition par virginie2 le Lun Juil 23, 2007 16:24; édité 2 fois |
|
| |
|
 |
nickargall WRInaute accro

Inscrit le: 13 Juin 2005 Messages: 2953 Localisation: Exilé au Groland à cause de Joe Dalton
|
Posté le : Lun Juil 23, 2007 15:14 Sujet du message: modifier un plugin de mon portail |
|
|
ouach le morceau de code Je crois que tu as atteint la limite du nombre de caractères possibles dans un post  |
|
| |
|
 |
virginie2 Nouveau WRInaute
Inscrit le: 27 Oct 2006 Messages: 15
|
Posté le : Lun Juil 23, 2007 16:35 Sujet du message: modifier un plugin de mon portail |
|
|
oui désolé pour tout ce code
c'etait pour qu'on puisse voir ou je dois intervenir. |
|
| |
|
 |
| |
|
|
|
|
Autres sujets de discussion :
Définitions :
|
|