j'ai deux petit problemes.
1 afficher les .ico et .cur .
2 mon lien pour telecharger le fichier présenté ne marche pas .
c'est un plugin d'un portail le e107 plugin e_player 1.8 que j'essais de modifier afin qu'il affiche les .bmp ,les .cur , .ico car sur mon futur site j'aimerai présenter des curseurs et des iconnes
page mes_iconnes.php et admin_media_common.php
voici le codede deux pages un peu lourd
<?php
require_once("../../class2.php");
if (!check_class($pref['mes_iconnes_view_class'])) {
// No access for current user
header("location:".e_BASE."index.php");
}
/* //////////////// */
if (eregi("request", e_QUERY))
{
$tmp = explode(".", e_QUERY);
$filename = substr(e_QUERY, strrpos(e_QUERY, "/")+1);
$bufsize = 2048;
ignore_user_abort(true);
$data_len = filesize($filename);
if ($seek > ($data_len - 1))
{
$seek = 0;
}
$res =& fopen($filename, 'rb');
if ($seek)
{
fseek($res , $seek);
}
$data_len -= $seek;
header("Expires: 0");
header("Cache-Control: max-age=30" );
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-Length: {$data_len}");
header("Pragma: public");
if ($seek)
{
header("Accept-Ranges: bytes");
header("HTTP/1.0 206 Partial Content");
header("status: 206 Partial Content");
header("Content-Range: bytes {$seek}-".($data_len - 1)."/{$data_len}");
}
while (!connection_aborted() && $data_len > 0)
{
echo fread($res , $bufsize);
$data_len -= $bufsize;
}
fclose($res);
}
/* //////////////// */
if (eregi("request_2", e_QUERY))
{
$tmp = explode(".", e_QUERY);
$filename2 = substr(e_QUERY, strrpos(e_QUERY, "/")+1);
$bufsize = 2048;
ignore_user_abort(true);
$data_len = filesize($filename2);
if ($seek_2 > ($data_len - 1))
{
$seek_2 = 0;
}
$res2 =& fopen($filename2, 'rb');
if ($seek_2)
{
fseek_2($res2 , $seek_2);
}
$data_len -= $seek_2;
header("Expires: 0");
header("Cache-Control: max-age=30" );
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-Length: {$data_len}");
header("Pragma: public");
if ($seek_2)
{
header("Accept-Ranges: bytes");
header("HTTP/1.0 206 Partial Content");
header("status: 206 Partial Content");
header("Content-Range: bytes {$seek_2}-".($data_len - 1)."/{$data_len}");
}
while (!connection_aborted() && $data_len > 0)
{
echo fread($res2 , $bufsize);
$data_len -= $bufsize;
}
fclose($res2);
}
/* //////////////// */
require_once(e_PLUGIN."mes_iconnes/mes_iconnes_variables.php");
define("PAGE_NAME", $pref['mes_iconnes_title']);
require_once(e_HANDLER."comment_class.php");
require_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_comment.php");
$mes_iconnestable = "mes_iconnes";
$categorytable = "mes_iconnes_category";
$aj = new textparse;
$sql2 = new db;
$con = new convert;
$cobj = new comment;
$clipsPerPage = $pref['mes_iconnes_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 and find_in_set(cat_visibility,'".$e107Helper->getUserClassList()."') order by cat_display_order asc");
$text .= "<tr><td colspan='4' class='forumheader'>".MES_ICONNES_LAN_01."</td></tr>";
while (list($catid, $catname, $catdescription, $caticon, $catdisplay_order, $cat_parent, $cat_visibility) = $sql->db_Fetch()) {
$qry = "select * from ".MPREFIX."$mes_iconnestable 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'
and find_in_set(c.cat_visibility,'".$e107Helper->getUserClassList()."')
";
$count = $sql2->db_Select_gen($qry);
$numsubcats = $sql2->db_Count($categorytable." where cat_parent_category='$catid'and find_in_set(cat_visibility,'".$e107Helper->getUserClassList()."')");
$text .= "<tr><td class='forumheader3' style='text-align:center' width='6%'>";
if ($count) {
$text .= "<a href='mes_iconnes.php?cat.$catid.0.$clipsPerPage'><img src='$caticon' style='border:0px' /></a></td>
<td class='forumheader3' valign='top' width='54%'>+6+<a href='mes_iconnes.php?cat.$catid.0.$clipsPerPage'>$catname</a>";
} else if ($numsubcats) {
$text .= "+7+<a href='mes_iconnes.php?cat.$catid.0.$clipsPerPage'><img src='$caticon' style='border:0px' /></a></td>
<td class='forumheader3' width='40%'>+8+<a href='mes_iconnes.php?cat.$catid.0.$clipsPerPage'>$catname</a>";
} else {
$text .= "<img src='$caticon' style='border:0px' /></td>
<td class='forumheader3'>-2-$catname";
}
$sql2->db_Select($mes_iconnestable, "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 /><br /><br /><span class='smalltext'>$catdescription</span></td>
<td class='forumheader3' style='text-align:left' class='smalltext' width='30%' valign='top'>hh $count ".MES_ICONNES_LAN_14.", $numsubcats ".MES_ICONNES_LAN_32."<br /><br /><br /><span class='smalltext' align='top'>".MES_ICONNES_LAN_23." $ts</td></tr>";
}
$text .= "<tr><td class='forumheader' style='text-align:right' colspan='3'>";
$text .= "<form method='post' action='mes_iconnes.php?search'>";
if (check_class($pref['mes_iconnes_upload_class'])) {
$text .= "<div style='float:left;'>+9+<a href='".e_SELF."?upload'>[".MES_ICONNES_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='".MES_ICONNES_LAN_44."' />";
$text .= "</div></form>";
$text .= "</td></tr>";
}
switch ($pref["mes_iconnes_display_order"]) {
case MES_ICONNES_LAN_ADMIN_PREF_03_3 : {
$order = "datestamp asc, timestamp asc";
break;
}
case MES_ICONNES_LAN_ADMIN_PREF_03_4 : {
$order = "datestamp desc, timestamp desc";
break;
}
case MES_ICONNES_LAN_ADMIN_PREF_03_5 : {
$order = "timestamp asc, datestamp asc";
break;
}
case MES_ICONNES_LAN_ADMIN_PREF_03_6 : {
$order = "timestamp desc, datestamp desc";
break;
}
default : {
$order = "title ASC";
break;
}
}
/* //// Cochez pour voir si demande de télécharger un fichier /////////////// */
if (eregi("upload", e_QUERY)) {
$text .= "<tr><td class='np' style='text-align:left'>-5-<a href='mes_iconnes.php'><< ".MES_ICONNES_LAN_22." ".MES_ICONNES_LAN_01."</a><tr><td>";
$text .= mes_iconnesAdd();
$text .= "</td></tr>";
}
// Cochez pour voir si nous sommes pour télécharger un fichier
if (eregi("submit", e_QUERY)) {
// Check for mandatory fields
/* ////////////////////////////////////////////////////////////////////////// */
$mes_iconnes_filename = $_FILES["mes_iconnes_filename"];
if (strlen($mes_iconnes_filename["name"][0]) == 0) {
$message .= MES_ICONNES_LAN_ADMIN_MEDIA_03_0." ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
}
/* ////////////////////////////////////////////////////////////////////////// */
$mes_iconnes_filename2 = $_FILES["mes_iconnes_filename2"];
if (strlen($mes_iconnes_filename2["name"][0]) == 0) {
$message .= MES_ICONNES_LAN_ADMIN_MEDIA_03_0." ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
}
/* ////////////////////////////////////////////////////////////////////////// */
if (strlen($_POST['title']) == 0) {
$message .= MES_ICONNES_LAN_ADMIN_MEDIA_00_0." ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
}
if (strlen($message) > 0)
{
$text .= "<tr><td>-6-";
$text .= mes_iconnesAdd($message);
$text .= "</td></tr>";
}
else
{
/* ////////////////////////////////////////////////////////////////////////// */
if (is_uploaded_file($mes_iconnes_filename['tmp_name'][0])){
if ($_POST["mediatype"] == 0)
{
$mes_iconnes_dir = $pref["mes_iconnes_image_dir"];
}
else
{
$mes_iconnes_dir = $pref["mes_iconnes_media_dir"];
}
$mes_iconnes_file = e_FILE.$mes_iconnes_dir."/".ereg_replace("[^a-z0-9._]", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($mes_iconnes_filename['name'][0])))) ;
if (move_uploaded_file($mes_iconnes_filename['tmp_name'][0] , $mes_iconnes_file ))
/* ////////////////////////////////////////////////////////////////////////// */
if (is_uploaded_file($mes_iconnes_filename2['tmp_name'][0]) ){
if ($_POST["mediatype"] == 0)
{
$mes_iconnes_dir_2 = $pref["mes_iconnes_image_dir_2"];
}
else
{
$mes_iconnes_dir_2 = $pref["mes_iconnes_media_dir_2"];
}
$mes_iconnes_file2 = e_FILE.$mes_iconnes_dir_2."/".ereg_replace("[^a-z0-9._]", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($mes_iconnes_filename2['name'][0])))) ;
if (move_uploaded_file($mes_iconnes_filename2['tmp_name'][0] , $mes_iconnes_file2 ))
/* ////////////////////////////////////////////////////////////////////////// */
{
$query = "0, "; /* // id ////////////// */
$query .= "'".$mes_iconnes_file."', "; /* // filename //////// */
$query .= "'".$mes_iconnes_file2."', "; /* // filename2 /////// */
$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("mes_iconnes", $query)) {
$text .= "<tr><td>-0-";
$text .= mes_iconnesAdd(MES_ICONNES_LAN_49);
$text .= "</td></tr>";
if (strlen($pref["mes_iconnes_email_notification"]) > 0) {
require_once(e_HANDLER."mail.php");
$sql2->db_Select($categorytable, "*", "cat_id='".$_POST["category"]."'");
list($catid, $catname) = $sql2->db_Fetch();
$msg = MES_ICONNES_LAN_52;
$msg .= mes_iconnesGetEMailLine(MES_ICONNES_LAN_ADMIN_MEDIA_03_0, $mes_iconnes_file);
$msg .= mes_iconnesGetEMailLine(MES_ICONNES_LAN_ADMIN_MEDIA_03_0, $mes_iconnes_file2);
$msg .= mes_iconnesGetEMailLine(MES_ICONNES_LAN_ADMIN_MEDIA_00_0, $_POST["title"]);
$msg .= mes_iconnesGetEMailLine(MES_ICONNES_LAN_ADMIN_MEDIA_02_0, $catname);
$msg .= mes_iconnesGetEMailLine(MES_ICONNES_LAN_ADMIN_MEDIA_16_0, USERNAME);
sendemail($pref['mes_iconnes_email_notification'], // send to email
"[".$pref['mes_iconnes_title']."]".MES_ICONNES_LAN_51, // subject
$msg, // message
"", // send to name
"", // send from email
"", // send from name
"", // attachments
"", // cc
"", // bcc
$pref['siteadminemail'], // return path
"" // return receipt
);
}
} else {
print mysql_error();
$text .= "<tr><td>-7-";
$text .= mes_iconnesAdd(MES_ICONNES_LAN_48);
$text .= "</td></tr>";
}
} else {
$text .= "<tr><td>-8-";
$text .= mes_iconnesAdd(MES_ICONNES_LAN_48);
$text .= "</td></tr>";
}
} else {
print mysql_error();
$text .= "<tr><td>-9-";
$text .= mes_iconnesAdd(MES_ICONNES_LAN_48);
$text .= "</td></tr>";
}} /* ////////////////////////////////////// ajout d une accolade */
}
}
// Check to see if we are searching
if (eregi("search", e_QUERY)) {
$text .= "<tr><td colspan='3' class='np' style='text-align:left'>+10+<a href='mes_iconnes.php'><< ".MES_ICONNES_LAN_22." ".MES_ICONNES_LAN_01."</a></td></tr>";
$text .= "<tr><td colspan='2' class='forumheader' width='66%'>$catname<br /><span class='smalltext'>$catdescription -10-</span></td>";
$text .= "<td class='forumheader' style='text-align:center'>";
$text .= "<span class='smallblacktext'>$count ".MES_ICONNES_LAN_14."</span>";
$text .= "</td></tr>";
$search = $_POST["search"];
$qry = "SELECT * from ".MPREFIX."$mes_iconnestable as e
left join ".MPREFIX."$categorytable as c on e.category = c.cat_id
WHERE (
e.title like '%$search%'
OR e.description like '%$search%')
AND e.approved='0'
AND find_in_set(c.cat_visibility,'".$e107Helper->getUserClassList()."')
ORDER BY $order
";
if ($sql->db_Select_gen($qry)) {
$text .= "<tr><td colspan='4' class='forumheader2'>".MES_ICONNES_LAN_27." -11-</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'>666<a href='mes_iconnes.php?view.$id.0.$clipsPerPage'>nnn<img src='$icon' style='border:0px' /></a></td>
<td class='forumheader3'>777<a href='mes_iconnes.php?view.$id.0.$clipsPerPage'>$title</a><br />$description</td>
<td class='forumheader3' style='text-align:center'>".MES_ICONNES_LAN_21. "$author";
if ($datestamp > 0) {
$date = $gen->convert_date($datestamp, "short");
$text .= "-12-<br />$date";
}
if ($timestamp > 0) {
$date = $gen->convert_date($timestamp, "short");
$text .= "-13-<br />".MES_ICONNES_LAN_24.": $date";
}
$text .= "-14-<br />".MES_ICONNES_LAN_41.": $viewcount";
if ($lastview > 0) {
$text .= "-15-<br />".MES_ICONNES_LAN_42.": ".$gen->convert_date($lastview, "short");
} else {
$text .= "-16-<br />".MES_ICONNES_LAN_43;
}
$text .= "</td></tr>";
}
} else {
$text .= "<tr><td class='forumheader3' colspan='3'>-17-".MES_ICONNES_LAN_45."</td></tr>";
}
$text .= "<tr><td class='forumheader3' style='text-align:right' colspan='3'>";
$text .= "<form method='post' action='mes_iconnes.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='".MES_ICONNES_LAN_44."' />";
$text .= "</form>";
$text .= "</td></tr>";
}
// Assurez-vous que nous devrions afficher des clips dans une catégorie
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."$mes_iconnestable 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'
and find_in_set(c.cat_visibility,'".$e107Helper->getUserClassList()."')
";
$count = $sql2->db_Select_gen($qry);
$numsubcats = $sql2->db_Count($categorytable." where cat_parent_category='$catid'and find_in_set(cat_visibility,'".$e107Helper->getUserClassList()."')");
$text .= "<tr><td colspan='3' class='np' style='text-align:left'>+11+<a href='mes_iconnes.php'><< ".MES_ICONNES_LAN_22." ".MES_ICONNES_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'>+12+<a href='mes_iconnes.php?cat.$catparent.0.$clipsPerPage'><< ".MES_ICONNES_LAN_22." ".$tmp['cat_name']."</a></td></tr>";
}
}
$text .= "<tr><td colspan='3' class='forumheader' width=''>-18-$catname<br /><br /><br /><span class='smalltext'>$catdescription</span>
<span class='smallblacktext' >$count ".MES_ICONNES_LAN_14."</span>";
$text .= "</td></tr>";
// Displaying a category - check for sub-categories first
$sql->db_Select($categorytable, "*", "cat_parent_category=$catid and find_in_set(cat_visibility,'".$e107Helper->getUserClassList()."') order by cat_display_order asc", true);
if ($numsubcats > 0) {
$text .= "<tr><td colspan='4' class='forumheader2'>-20-".MES_ICONNES_LAN_26."</td></tr>";
}
while (list($parentcatid, $catname, $catdescription, $caticon, $catdisplay_order) = $sql->db_Fetch()) {
$count = $sql2->db_Select($mes_iconnestable, "*", "category=$parentcatid and approved='0' order by timestamp desc");
$text .= "<tr><td class='forumheader3' style='text-align:center' width='6%'>";
if ($count) {
$text .= "<a href='mes_iconnes.php?cat.$catid.0.$clipsPerPage'><img src='$caticon' style='border:0px' /></a></td>
<td class='forumheader3' valign='top'>+14+<a href='mes_iconnes.php?cat.$parentcatid.0.$clipsPerPage'>$catname</a>";
} else {
$text .= "ggg<img src='$caticon' style='border:0px' /></td>
<td class='forumheader3'>$catname";
}
list($eid, $filename, $filename2, $title, $category, $datestamp, $description, $icon, $width, $height, $author, $comment, $timestamp) = $sql2->db_Fetch();
$ts = $gen->convert_date($timestamp, "short");
$text .= "<!--<br /><br /><br /><span class='smalltext'>-22-$catdescription</span> --></td>
<td class='forumheader3' style='text-align:left' valign='top'>x2 $count ".MES_ICONNES_LAN_14."<br /><br /><br /><span class='smalltext'> ".MES_ICONNES_LAN_23." $ts <br /><br /> ".MES_ICONNES_LAN_471." ".MES_ICONNES_LAN_21." $author </td></tr>";
}
$count = $sql->db_Count($mes_iconnestable." WHERE category='$catid' and approved='0'");
if ($sql->db_Select($mes_iconnestable, "*", "category='$catid' and approved='0' ORDER BY $order LIMIT $from,$view", true)) {
$text .= "<tr><td colspan='4' class='forumheader2'>-24-".MES_ICONNES_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' width='6%'><a href='mes_iconnes.php?view.$id.0. $clipsPerPage'><img src='$icon' style='border:0px' /></a></td>
<td class='forumheader3' width='20%'><a href='mes_iconnes.php?view.$id.0.$clipsPerPage'>x3 $title </a><br /><br /><!--/<br />".MES_ICONNES_LAN_471." ".MES_ICONNES_LAN_21." $author/-->";
$text .= "<br />".MES_ICONNES_LAN_41." : $viewcount";
if (check_class($pref['mes_iconnes_download_class'])) {
$text .= "";
}
$text .= "</td><td class='forumheader3' style='text-align:left'><img src='$filename' border='2'/></a>uuuu<img src='$filename2' border='2'/>";
$text .= "</td></tr>";
}
}
$text .= "<tr><td colspan='3' class='forumheader'>-31-<a href='".e_SELF."?upload'>".MES_ICONNES_LAN_46."</a></td></tr><tr><td colspan='3'>";
$text .= mes_iconnesPaging($from, $view, $count, "cat.$catid");
$text .= "</td></tr>";
}
// Cochez pour voir si nous jouons un 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("mes_iconnes", "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'], "mes_iconnes", $id, $pid, $_POST['subject']);
if($pref['cachestatus']){
$e107cache->clear("comment.mes_iconnes.{$sub_action}");
}
}
}
}
$sql->db_Select($mes_iconnestable, "*", "id='$id'");
list($id, $filename, $filename2, $title, $category, $datestamp, $description, $icon, $width, $height, $author, $comment, $timestamp, $lastview, $viewcount) = $sql->db_Fetch();
// Increment view count
$sql->db_Update($mes_iconnestable, "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'>+1+<a href='mes_iconnes.php?cat.$catid.0. $clipsPerPage'><< ".MES_ICONNES_LAN_22." $catname</a></td></tr>";
$text2 .= "<tr><td class='forumheader3' width='4%' rowspan='5' >FFF<img src='".e_IMAGE.$pref["mes_iconnes_icon_dir"]."/$icon' style='border:0px' align='middle' /></td></tr>";
$text2 .= "<tr><td class='forumheader3'> ".MES_ICONNES_LAN_57."<span class='smalltext'> $title </span></td></tr>";
if (check_class($pref['mes_iconnes_download_class'])) {
$text2 .= "<tr><td class='forumheader3' > <a href='mes_iconnes.php?request.$filename'>".MES_ICONNES_LAN_53."</a>kkkk <a href='mes_iconnes.php?request_2.$filename2'>".MES_ICONNES_LAN_53."</a></td></tr>";
}
$text2 .= "<tr><td class='forumheader3' >".MES_ICONNES_LAN_58." <br /><br /><br /><div style='width: 300px; '><span class='smalltext'> $description </span></div></td></tr>";
$text2 .= "<td class='forumheader3' colspan='1' >".MES_ICONNES_LAN_471." ".MES_ICONNES_LAN_21." $author";
if ($datestamp > 0) {
$date = $gen->convert_date($datestamp, "short");
$text2 .= "<br /> $date</span>";
}
if ($timestamp > 0) {
$date = $gen->convert_date($timestamp, "short");
$text2 .= "<br />".MES_ICONNES_LAN_24." $date</span>";
}
$text2 .= "</td></tr>";
if ($pref['mes_iconnes_show_clip_details'] == MES_ICONNES_LAN_ADMIN_PREF_06_2) {
$text .= $text2;
}
/*bon a garder */
/* ////////////////////////////////////////////////////////////////////////// */
$text .= "<tr><td class='forumheader3' style='text-align:center;'colspan='2'>c11";
$mediaFunc = "mes_iconnesGet".strtoupper(substr($filename, strrpos($filename, ".")+1));
if(!function_exists($mediaFunc)) {
$mediaFunc = "mes_iconnesGetDefault";
}
$text .= call_user_func($mediaFunc, $filename, $width, $height);
$text .= "</td></tr>";
/* ////////////////////////////////////////////////////////////////////////// */
$text .= "<tr><td class='forumheader3' style='text-align:center;'colspan='2'>c22";
$mediaFunc = "mes_iconnesGet".strtoupper(substr($filename2, strrpos($filename2, ".")+1));
if(!function_exists($mediaFunc)) {
$mediaFunc = "mes_iconnesGetDefault";
}
$text .= call_user_func($mediaFunc, $filename2, $width, $height);
$text .= "</td></tr>";
/* ////////////////////////////////////////////////////////////////////////// */
/*bon*/
if ($comment == "1" && !$e107Helper->isV07()) {
$query = $pref['nested_comments'] ?
"comment_item_id='$id' AND comment_type='$mes_iconnestable' AND comment_pid='0' ORDER BY comment_datestamp" :
"comment_item_id='$id' AND comment_type='$mes_iconnestable' 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, $mes_iconnestable, "comment", $id, $width, $subject, true);
} else {
$text3 .= $cobj->render_comment($row, $mes_iconnestable, "comment", $id, $width, $subject, true);
}
}
if (ADMIN && getperms("B")) {
$text3 .= "<div style='text-align:right'>+3+<a href='".e_ADMIN."modcomment.php?mes_iconnes.$id'>".LAN_314."</a></div>";
}
}
}
$next = $prev = $lastid = 0;
if ($sql->db_Select($mes_iconnestable, "*", "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' class='np'>";
if ($prev > 0) {
$text .= "<div class='smalltext' style='float:left'><a href='$PHP_SELF?view.$prev.$from.$view'><< ".MES_ICONNES_LAN_38."</a></div>";
}
if ($next > 0) {
$text .= "<div class='smalltext' style='float:right'><a href='$PHP_SELF?view.$next.$from.$view'>".MES_ICONNES_LAN_39." >></a></div>";
}
$text .= "</td></tr>";
if ($pref['mes_iconnes_show_clip_details'] == MES_ICONNES_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'>-37-";
if ($ratearray = $rater->getrating("mes_iconnes", $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("mes_iconnes", $id) && USER) {
$ratetext = $rater->rateselect(" <b>-38-".RATELAN_2, "mes_iconnes", $id)."</b>";
if (!$e107Helper->isV07()) {
$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['mes_iconnes_title'], $text);
if ((eregi("view.", e_QUERY)) && ($comment == "1")) {
// e107 0.617
if (!$e107Helper->isV07()) {
if (strlen($text3) > 0) {
$ns->tablerender(LAN_5, $text3);
}
$cobj->form_comment("comment", "mes_iconnes", $id, $subject, $content_type);
} else {
// e107 0.7
$cobj->compose_comment("mes_iconnes", "comment", $id, $width, $subject, $showrate=false);
}
}
require_once(FOOTERF);
exit;
function mes_iconnesPaging($from, $view, $total, $qs) {
if ($total == 0) {
return;
}
$text = "<table width='100%'><tr>";
$text .= "<td style='width:25%;text-align:left' class='np'>-39-";
if ($from > 0) {
$s = $from - $view;
$text .= "<span class='smalltext'><a href='$PHP_SELF?$qs.$s.$view'>< ".MES_ICONNES_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'>-40-";
$text .= "<span class='smallblacktext'>".MES_ICONNES_LAN_18." $start ".MES_ICONNES_LAN_19." $finish ".MES_ICONNES_LAN_20." $total</span></td>";
$s = $from + $view;
$text .= "<td style='width:25%;text-align:right' class='np'> -41-";
if ($s < $total) {
$text .= "<span class='smalltext'>555<a href='$PHP_SELF?$qs.$s.$view'>".MES_ICONNES_LAN_17." ></a> </span></td>";
}
$text .= "</tr></table>";
return $text;
}
function mes_iconnesGetMOV($url, $w, $h) {
// Add height to allow for controls area
$h += 18;
$text = "-42-
<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 mes_iconnesGetSWF($url, $w, $h) {
global $pref;
$size = getimagesize($url);
$w = $size[0];
$h = $size[1];
if ($pref["mes_iconnes_max_width"] != "") {
$max = $pref["mes_iconnes_max_width"];
if ($w > $max) {
$h = intval($h / ($w/$max));
$w = $max;
}
}
$text = "-43-
<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 mes_iconnesGetASX($url, $w, $h) {
$text = "-44-
<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 mes_iconnesGetRM($url, $w, $h) {
return mes_iconnesGetRAM($url, $w, $h);
}
function mes_iconnesGetRPM($url, $w, $h) {
return mes_iconnesGetRAM($url, $w, $h);
}
function mes_iconnesGetRAM($url, $w, $h) {
$text = "-45-
<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>
+4+<a href='$url'>".MES_ICONNES_LAN_33."</a>
";
return $text;
}
function mes_iconnesGetJPG($url, $w, $h) {
return mes_iconnesGetImage($url, $w, $h);
}
function mes_iconnesGetJPEG($url, $w, $h) {
return mes_iconnesGetImage($url, $w, $h);
}
function mes_iconnesGetPNG($url, $w, $h) {
return mes_iconnesGetImage($url, $w, $h);
}
function mes_iconnesGetGIF($url, $w, $h) {
return mes_iconnesGetImage($url, $w, $h);
}
function mes_iconnesGetImage($url, $w, $h) {
global $pref;
$size = getimagesize($url);
$w = $size[0];
$h = $size[1];
if ($pref["mes_iconnes_max_width"] != "") {
$max = $pref["mes_iconnes_max_width"];
if ($w > $max) {
$h = intval($h / ($w/$max));
$w = $max;
}
}
$text = "jjj<!--<a href='$url' target='_new'>--><img src='$url' width='$w' height='$h' border='0' />4<br /><!-- ".MES_ICONNES_LAN_34." </a> -->";
if (function_exists(exif_read_data)) {
$exif = exif_read_data($url, 0, true);
if ($exif) {
$text .= "<div onclick=expandit('mes_iconnes_exif_info') >".MES_ICONNES_LAN_37;
$text .= "<div id='mes_iconnes_exif_info' class='forumheader2' style='display:none;'><table>";
foreach ($exif as $key => $section) {
//$text .= "<tr><td colspan='2'> $key </td></tr>";
foreach ($section as $name => $val) {
if ($val != NULL && strlen(trim($val)) > 0 && strtolower(substr($name, 0, 12)) != "undefinedtag") {
//choisir certains attributs qui peuvent être affichés mieux
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><tr><td class='np' colspan='2'> 123456 </td></tr>";
}
}
return $text;
}
// Handles, amongst others, MPG, MPEG, WMV
function mes_iconnesGetDefault($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 mes_iconnesAdd($msg=false) {
global $ns;
$categorytable = "mes_iconnes_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;
/* bon a garder */
////////////////////////////////////////////////////////////////////////////////////
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_03_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_03_2;
$fieldname[] = "mes_iconnes_filename[]";
$fieldtype[] = "file";
$fieldvalu[] = ",40,255";
$fieldmand[] = "*";
////////////////////////////////////////////////////////////////////////////////////
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_03_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_03_2;
$fieldname[] = "mes_iconnes_filename2[]";
$fieldtype[] = "file";
$fieldvalu[] = ",40,255";
$fieldmand[] = "*";
////////////////////////////////////////////////////////////////////////////////////
/* bon */
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_02_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_02_1;
$fieldname[] = "category";
$fieldtype[] = "dropdown2";
$fieldvalu[] = $categories;
$fieldmand[] = "*";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_00_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_00_1;
$fieldname[] = "title";
$fieldtype[] = "text";
$fieldvalu[] = ",40,100";
$fieldmand[] = "*";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_01_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_01_1;
$fieldname[] = "description";
$fieldtype[] = "textarea";
$fieldvalu[] = ",90%,100px";
$fieldmand[] = "";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_08_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_08_1;
$fieldname[] = "datestamp";
$fieldtype[] = "datestamp";
$fieldvalu[] = "2000";
$fieldmand[] = "";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_14_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_14_1;
$fieldname[] = "mediatype";
$fieldtype[] = "dropdown2";
$fieldvalu[] = "0:".MES_ICONNES_LAN_ADMIN_MEDIA_14_2.",1:".MES_ICONNES_LAN_ADMIN_MEDIA_14_3.",2:".MES_ICONNES_LAN_ADMIN_MEDIA_14_4;
$fieldmand[] = "";
$text .= "<form enctype='multipart/form-data' method='post' name='mes_iconnes' action='".e_SELF."?submit'>";
$text .= "<table class='fborder' style='width:100%'>";
if (check_class($pref['mes_iconnes_upload_class'])) {
$text .= "<tr><td class='forumheader' colspan='2'>-49-".MES_ICONNES_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'>-50-<button class='' name='mes_iconnessubmit' type='submit'>".MES_ICONNES_LAN_47."</button></td></tr>";
$text .= "</table></form>";
return $text;
}
function mes_iconnesGetEMailLine($label, $text) {
//print "age_GetEMailLine($label, $text)<br>";
if (strlen($label) > 0 && strlen($text) > 0) {
return "\n$label: $text";
}
return "";
}
?>
<?php
/*
*/
if (!getperms("P")) {
header("location:".e_BASE."index.php");
}
require_once(e_ADMIN."auth.php");
require_once(e_PLUGIN."mes_iconnes/mes_iconnes_variables.php");
require_once(e_PLUGIN."mes_iconnes/mes_iconnes_utils.php");
$debug = false;
$sql2 = new db;
/* ////////////////////////////////////////////////////////////////////////// */
if ($pageid == "media_local") {
$configtitle = MES_ICONNES_LAN_ADMIN_00;
$ep_existing_sql = " filename like '..%' and filename not like '%.jpg' and filename not like '%.jpeg' and filename not like '%.png' and filename not like '%.gif' and filename not like '%.ico' order by title asc";
} else if ($pageid == "media_remote") {
$configtitle = MES_ICONNES_LAN_ADMIN_03;
$ep_existing_sql = " filename like '%://%' and filename not like '%.jpg' and filename not like '%.jpeg' and filename not like '%.png' and filename not like '%.gif' and filename not like '%.ico' order by title asc";
} else if ($pageid == "image_local") {
$configtitle = MES_ICONNES_LAN_ADMIN_04;
$ep_existing_sql = " filename like '..%' and (filename like '%.jpg' or filename like '%.jpeg' or filename like '%.png' or filename like '%.gif' or filename like '%.ico' ) order by title asc";
} else {
$configtitle = MES_ICONNES_LAN_ADMIN_05;
$ep_existing_sql = " filename like '%://%' and (filename like '%.jpg' or filename like '%.jpeg' or filename like '%.png' or filename like '%.gif' or filename like '%.ico' ) order by title asc";
}
/* ///////////////////////// */
if ($pageid == "media_local_2") {
$configtitle = MES_ICONNES_LAN_ADMIN_00_a;
$ep_existing_sql = " filename2 like '..%' and filename2 not like '%.jpg' and filename2 not like '%.jpeg' and filename2 not like '%.png' and filename2 not like '%.gif' and filename2 not like '%.ico' order by title asc";
} else if ($pageid == "media_remote") {
$configtitle = MES_ICONNES_LAN_ADMIN_03_a;
$ep_existing_sql = " filename2 like '%://%' and filename2 not like '%.jpg' and filename2 not like '%.jpeg' and filename2 not like '%.png' and filename2 not like '%.gif' and filename2 not like '%.ico' order by title asc";
} else if ($pageid == "image_local") {
$configtitle = MES_ICONNES_LAN_ADMIN_04_a;
$ep_existing_sql = " filename2 like '..%' and (filename2 like '%.jpg' or filename2 like '%.jpeg' or filename2 like '%.png' or filename2 like '%.gif' or filename2 like '%.ico' ) order by title asc";
} else {
$configtitle = MES_ICONNES_LAN_ADMIN_05_a;
$ep_existing_sql = " filename2 like '%://%' and (filename2 like '%.jpg' or filename2 like '%.jpeg' or filename2 like '%.png' or filename2 like '%.gif' or filename2 like '%.ico' ) order by title asc";
}
/* ////////////////////////////////////////////////////////////////////////// */
$mes_iconnestable = "mes_iconnes";
$categorytable = "mes_iconnes_category";
$primaryid = "id";
$e_wysiwyg = "";
$show_preset = FALSE;
$sql->db_Select($categorytable, "*", " order by cat_name asc", "");
$categories = "";
if (list($id, $name, $description, $icon) = $sql->db_Fetch()) {
$categories .= "$id:$name";
while (list($id, $name, $description, $icon) = $sql->db_Fetch()) {
$categories .= ",$id:$name";
}
}
/* ////////////////////////////////////////////////////////////////////////// */
if (strpos($pageid, "local") > 0)
{
if ($pageid == "media_local")
{
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_03_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_03_1;
$fieldvalu[] = mes_iconnesGetFiles(e_FILE, $pref["mes_iconnes_media_dir"]);
}
else
{
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_11_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_11_1;
$fieldvalu[] = mes_iconnesGetFiles(e_FILE, $pref["mes_iconnes_image_dir"]);;
}
$fieldname[] = "filename";
$fieldtype[] = "dropdown2";
$fieldmand[] = "*";
}
else
{
if ($pageid == "media_remote")
{
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_10_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_10_1;
}
else
{
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_12_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_12_1;
}
$fieldname[] = "filename";
$fieldtype[] = "text";
$fieldvalu[] = "http://,50,200";
$fieldmand[] = "*";
}
/* ///////////////////////// */
if (strpos($pageid, "local") > 0)
{
if ($pageid == "media_local_2")
{
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_03_0_a;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_03_1_a;
$fieldvalu[] = mes_iconnesGetFiles(e_FILE, $pref["mes_iconnes_media_dir_2"]);
}
else
{
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_11_0_a;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_11_1_a;
$fieldvalu[] = mes_iconnesGetFiles(e_FILE, $pref["mes_iconnes_image_dir_2"]);;
}
$fieldname[] = "filename2";
$fieldtype[] = "dropdown2";
$fieldmand[] = "*";
}
else
{
if ($pageid == "media_remote_2")
{
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_10_0_a;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_10_1_a;
}
else
{
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_12_0_a;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_12_1_a;
}
$fieldname[] = "filename2";
$fieldtype[] = "text";
$fieldvalu[] = "http://,50,200";
$fieldmand[] = "*";
}
/* ////////////////////////////////////////////////////////////////////////// */
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_00_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_00_1;
$fieldname[] = "title";
$fieldtype[] = "text";
$fieldvalu[] = ",50,100";
$fieldmand[] = "*";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_02_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_02_1;
$fieldname[] = "category";
$fieldtype[] = "dropdown2";
$fieldvalu[] = $categories;
$fieldmand[] = "*";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_08_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_08_1;
$fieldname[] = "datestamp";
$fieldtype[] = "datestamp";
$fieldvalu[] = "2000";
$fieldmand[] = "";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_01_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_01_1;
$fieldname[] = "description";
$fieldtype[] = "textarea";
$fieldvalu[] = ",90%,100px";
$fieldmand[] = "";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_04_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_04_1;
$fieldname[] = "icon";
$fieldtype[] = "image";
$fieldvalu[] = e_IMAGE.$pref["mes_iconnes_icon_dir"]."/";
$fieldmand[] = "";
/* ////////////////////////////////////////////////////////////////////////// */
if ($pageid == "media_local" || $pageid == "media_remote") {
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_05_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_05_1;
$fieldname[] = "width";
$fieldtype[] = "text";
$fieldvalu[] = $pref["mes_iconnes_default_width"].",4,4";
$fieldmand[] = "";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_06_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_06_1;
$fieldname[] = "height";
$fieldtype[] = "text";
$fieldvalu[] = $pref["mes_iconnes_default_height"].",4,4";
$fieldmand[] = "";
} else {
$fieldcapt[] = "";
$fieldnote[] = "";
$fieldname[] = "width";
$fieldtype[] = "hidden";
$fieldvalu[] = "0";
$fieldmand[] = "";
$fieldcapt[] = "";
$fieldnote[] = "";
$fieldname[] = "height";
$fieldtype[] = "hidden";
$fieldvalu[] = "0";
$fieldmand[] = "";
}
/* ///////////////////////// */
if ($pageid == "media_local_2" || $pageid == "media_remote_2") {
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_05_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_05_1;
$fieldname[] = "width";
$fieldtype[] = "text";
$fieldvalu[] = $pref["mes_iconnes_default_width"].",4,4";
$fieldmand[] = "";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_06_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_06_1;
$fieldname[] = "height";
$fieldtype[] = "text";
$fieldvalu[] = $pref["mes_iconnes_default_height"].",4,4";
$fieldmand[] = "";
} else {
$fieldcapt[] = "";
$fieldnote[] = "";
$fieldname[] = "width";
$fieldtype[] = "hidden";
$fieldvalu[] = "0";
$fieldmand[] = "";
$fieldcapt[] = "";
$fieldnote[] = "";
$fieldname[] = "height";
$fieldtype[] = "hidden";
$fieldvalu[] = "0";
$fieldmand[] = "";
}
/* ////////////////////////////////////////////////////////////////////////// */
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_09_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_09_1;
$fieldname[] = "author";
$fieldtype[] = "text";
$fieldvalu[] = USERNAME.",50,100";
$fieldmand[] = "";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_07_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_07_1;
$fieldname[] = "comment";
$fieldtype[] = "checkbox";
$fieldvalu[] = "1";
$fieldmand[] = "";
$fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_15_0;
$fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_15_1;
$fieldname[] = "approved";
$fieldtype[] = "checkbox";
$fieldvalu[] = "0";
$fieldmand[] = "";
/* ////////////////////////////////////////////////////////////////////////// */
// END OF CONFIGURATION AREA
/* ////////////////////////////////////////////////////////////////////////// */
// -------- Presets. ------------ // toujours charge avant auth.php
if ($show_preset) {
require_once(e_HANDLER."preset_class.php");
$pst = new e_preset;
$pst->form = "adminform"; // form id of the form that will have it's values saved.
$pst->page = e_SELF; // display preset options on which page(s).
$pst->id = "admin_".$mes_iconnestable;
}
if ($categories=="") {
$ns->tablerender($configtitle, MES_ICONNES_LAN_ADMIN_MEDIA_13);
require_once(e_ADMIN."footer.php");
return;
}
require_once(e_ADMIN."auth.php");
require_once("form_handler.php");
$rs = new form;
// Page config checks
$toapprove = isset($_POST['toapprove']) && !isset($_POST['showall']) ? true : false;
// Validation checks
if (isset($_POST['add']) || isset($_POST['update'])) {
if (strlen($_POST['filename']) == 0) {
$message .= "File name ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
}
if (strlen($_POST['title']) == 0) {
$message .= "Title ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
}
}
if (isset($_POST['add']) || isset($_POST['update'])) {
if (strlen($_POST['filename2']) == 0) {
$message .= "File name2 ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
}
if (strlen($_POST['title']) == 0) {
$message .= "Title ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
}
}
// Data is valid so try and add
if (!isset($message) && isset($_POST['add'])) {
if ($debug) print "<br>".print_r($_POST)."<br>";
$count = count($fieldname);
for ($i=0; $i<$count; $i++) {
if ($fieldname[$i] == "datestamp" && $pref["mes_iconnes_use_exif"] == "1") {
if (function_exists(exif_read_data)) {
$exif = exif_read_data($rs->getfieldvalue($fieldname[0], $fieldtype[0], $debug), 0, true);
if ($exif && isset($exif['EXIF']['DateTimeOriginal'])) {
$tmp = $exif['EXIF']['DateTimeOriginal'];
$inputstr .= " '".mktime(substr($tmp,11,2), substr($tmp,14,2), substr($tmp,17,2), substr($tmp,5,2), substr($tmp,8,2), substr($tmp,0,4))."', ";
} else {
$inputstr .= " '".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
}
} else {
$inputstr .= " '".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
}
} else {
$inputstr .= " '".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
}
}
$inputstr .= time(); // timestamp
$inputstr .= ", 0"; // lastview
$inputstr .= ", 0"; // viewcount
if ($sql->db_Insert($mes_iconnestable, "0, $inputstr", $debug)) {
$message = MES_ICONNES_LAN_ADMIN_MEDIA_06;
unset($_POST['add']);
} else {
$message = MES_ICONNES_LAN_ADMIN_MEDIA_07;
//print mysql_error()." ".$inputstr;
}
}
/* ////////////////////////////////////////////////////////////////////////// */
// Data is valid so try and update
/* ////////////////////////////////////////////////////////////////////////// */
if (!isset($message) && isset($_POST['update'])) {
if ($debug) print "<br>".print_r($_POST)."<br>";
$count = count($fieldname);
for ($i=0; $i<$count; $i++) {
if ($fieldname[$i] == "datestamp" && $pref["mes_iconnes_use_exif"] == "1") {
if (function_exists(exif_read_data)) {
$exif = exif_read_data($rs->getfieldvalue($fieldname[0], $fieldtype[0], $debug), 0, true);
if ($exif && isset($exif['EXIF']['DateTimeOriginal'])) {
$tmp = $exif['EXIF']['DateTimeOriginal'];
$inputstr .= $fieldname[$i]."='".mktime(substr($tmp,11,2), substr($tmp,14,2), substr($tmp,17,2), substr($tmp,5,2), substr($tmp,8,2), substr($tmp,0,4))."', ";
} else {
$inputstr .= $fieldname[$i]."='".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
}
} else {
$inputstr .= $fieldname[$i]."='".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
}
} else {
$inputstr .= $fieldname[$i]."='".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
}
}
$inputstr .= "timestamp=".time();
if ($sql->db_Update($mes_iconnestable, "$inputstr WHERE $primaryid='".$_POST[$primaryid]."'", $debug)) {
$message = MES_ICONNES_LAN_ADMIN_MEDIA_04;
unset($_POST['update']);
} else {
if ($debug) print "<br>".mysql_error()."<br>";
$message = MES_ICONNES_LAN_ADMIN_MEDIA_05;
}
}
// Get details from DB if Edit, otherwise set from POST data
/* ////////////////////////////////////////////////////////////////////////// */
if (isset($_POST['edit'])) {
$sql -> db_Select($mes_iconnestable, "*", " $primaryid='".$_POST['existing']."' ");
$row = $sql->db_Fetch();
} else {
if (isset($_POST['add']) || isset($_POST['update'])) {
$row = $_POST;
}
}
// Try the delete
/* ////////////////////////////////////////////////////////////////////////// */
if (isset($_POST['delete'])) {
if ($debug) print "<br>".print_r($_POST)."<br>";
$message = ($sql -> db_Delete($mes_iconnestable, "$primaryid='".$_POST['existing']."' ")) ? MES_ICONNES_LAN_ADMIN_MEDIA_08 : MES_ICONNES_LAN_ADMIN_MEDIA_09;
}
// Draw the form
if (file_exists(e_PLUGIN."updatechecker/updatechecker.php")) {
require_once(e_PLUGIN."updatechecker/updatechecker.php");
$text .= updateChecker(MES_ICONNES_LAN_NAME, MES_ICONNES_LAN_VER, "http://www.bugrain.plus.com/e107plugins/mes_iconnes.ver", "|");
}
$text .= "<div style='text-align:center'><form method='post' action='".e_SELF."' id='myexistingform'>
<table style='width:96%;margin-left:auto;margin-right:auto;' class='fborder'>";
if (isset($message)) {
$text .= "<tr><td colspan='2' class='spacer' style='text-align:center'>$message</td></tr>";
if ($debug) print "<br>".mysql_error()."<br>";
}
$text .= "<tr><td colspan='2' class='forumheader' style='text-align:center'>";
if ($toapprove) {
$ep_existing_sql = "approved<>'0' and $ep_existing_sql";
}
$table_total = $sql->db_Select($mes_iconnestable, "id, filename, filename2, title, category, approved", $ep_existing_sql, true, $debug);
if (!$table_total) {
$text .= MES_ICONNES_LAN_ADMIN_MEDIA_10;
if ($toapprove) {
$text .= "<br/><input class='button' type='submit' name='showall' value='".MES_ICONNES_LAN_ADMIN_MEDIA_15."' />";
}
} else {
$text .= "<span class='defaulttext'>".MES_ICONNES_LAN_ADMIN_MEDIA_00.":</span> <select name='existing' id='existing' class='tbox'>";
while (list($id, $filename, $filename2, $title, $category, $approved) = $sql-> db_Fetch()) {
$sql2->db_Select($categorytable, "*", "cat_id=$category");
list($catid, $catname, $rest) = $sql2->db_Fetch();
$approved = ($approved==0 && $approved!="") ? "" : "* ";
$text .= "<option value='$id'>$approved$title ($catname)</option>";
}
$text .= "</select><br/><input class='button' type='submit' name='edit' value='".MES_ICONNES_LAN_ADMIN_MEDIA_01."' />
<input class='button' type='submit' name='delete' value='".MES_ICONNES_LAN_ADMIN_MEDIA_11."' /> ";
/* if ($toapprove) {
$text .= "<input class='button' type='submit' name='showall' value='".MES_ICONNES_LAN_ADMIN_MEDIA_15."' />";
$text .= "<input type='hidden' name='toapprove' value='1' />";
} else {
$text .= "<input class='button' type='submit' name='toapprove' value='".MES_ICONNES_LAN_ADMIN_MEDIA_14."' />";
}*/
$text .= " <input class='button' type='button' onclick='window.open(\"admin_preview.php?\"+document.getElementById(\"existing\").value);' value='".MES_ICONNES_LAN_ADMIN_MEDIA_16."' />";
$text .= "</td></tr>";
}
$text .= "</table></form></div>";
$text .= "<div style='text-align:center'>\n";
$text .= "<form method='post' action='".e_SELF."' id='adminform'><table class='fborder' style='margin-left:auto;margin-right:auto;width:96%'>";
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='forumheader3'>".$fieldcapt[$i]." ".$fieldmand[$i]."<br><span class='smalltext'>".$fieldnote[$i]."</td>
<td class='forumheader3'>";
}
$text .= $rs->user_extended_element_edit($form_send, $row[$fieldname[$i]], $fieldname[$i]);
if ($fieldtype[$i] != "hidden") {
$text .="</td></tr>";
}
};
$text .= "<tr style='vertical-align:top'><td colspan='2' style='text-align:center' class='forumheader'>";
if (isset($_POST['edit']) || isset($_POST['update'])){
$text .= "<input class='button' type='submit' id='update' name='update' value='".MES_ICONNES_LAN_ADMIN_MEDIA_02."' />
<input type='hidden' name='$primaryid' value='".$row[$primaryid]."'>";
} else {
$text .= "<input class='button' type='submit' id='add' name='add' value='".MES_ICONNES_LAN_ADMIN_MEDIA_03."' />";
}
if ($toapprove) {
$text .= "<input type='hidden' name='toapprove' value='1' />";
}
$text .= "</td></tr></table></form></div>";
$ns->tablerender($configtitle, $text);
require_once(e_ADMIN."footer.php");
?>[/color]