Fork me on GitHub


 Bas   Précédent   Suivant

« 1 ... 3 4 5 (6) 7 8 9 ... 48 »


Re: Evolution de RSSFit
Régulier
Inscrit: 10/09/2007 11:51
Messages: 476
Re

j'ai installé la new version et à part l'administration qui à été refaite (bien) les autres problèmes subsiste:

Sanitization qui marche pas dans mon cas.

Posté le : 09/01/2015 11:54
Transférer la contribution vers d'autres applications Transférer


Re: Utiliser l'api allociné dans xoopstube
Régulier
Inscrit: 10/09/2007 11:51
Messages: 476
Re

oui je sais bien mais si je fais comme ça y'a rien qui s'affiche, voila pourquoi, j'ai ajouté une valeur au tableau et ça marche.

donc pas de soucis, c'est peut être pas la bonne syntaxe mais tant que le résultat est la, pas de soucis.

Normalement ,il faudrait réécrire complétement le fichier pour enlever tout ce qui ne sert plus, mais bon, pas grave.

cette fois tout fonctionne, je vous met les sources, on sait jamais ça pourra servir à d'autres.


*les 4 fichiers sont à mettre à la racine du module xoopstube.
Formulaire pour entrer le titre du film ou de la série à chercher:
*Ajouter un lien vers ce fichier à votre menu.
allocine.php
<?php
/**
 * $Id: allocine.php
 * Module: XoopsTube
 */

include 'header.php';
include 
XOOPS_ROOT_PATH '/header.php';
include 
XOOPS_ROOT_PATH '/class/xoopsformloader.php';
global 
$xoopsModule$xtubemyts$xoopsModuleConfig;

$cid intval(xtube_cleanRequestVars($_REQUEST'cid'0));

if (
FALSE == xtube_checkgroups($cid'XTubeSubPerm')) {
    
redirect_header('index.php'1_MD_XTUBE_NOPERMISSIONTOPOST);
    exit();
}

        
$alloform = new XoopsthemeForm(_MD_XTUBE_ALLOFORM_SEARCHTITLE'alloform''allosearch.php');
        
$alloform->addElement(new XoopsFormText(_MD_XTUBE_ALLOFILM_TITLE'filmtitle'70255), false);
        
$button_tray = new XoopsFormElementTray('''');
        
$button_tray->addElement(new XoopsFormButton('''submit'_SUBMIT'submit'));
        
$alloform->addElement($button_tray);
        
$alloform->display();
        
        
$xoopsTpl->assign('module_dir'$xoopsModule->getVar('dirname'));
include 
XOOPS_ROOT_PATH '/footer.php';
?>


Une fois le titre soumis on est redirigé vers la page des résultats:
*Ce présente sous forme de joli tableau(1 pour les films et 1 pour les séries) avec les images et on sélectionne la bonne fiche en 1 clic.
*Le titre est nettoyé de sa ponctuation, puis en cliquand sur la fiche,on envoi le bon code film pour par la suite récup les infos.
*attention, les classes css utilisé ne sont pas dans le xoopstube d'origine, adapter selon vos besoin.
allosearch.php
<?php
/**
 * $Id: allosearch.php
 * Module: XoopsTube
 */

include 'header.php';
include 
XOOPS_ROOT_PATH '/header.php';
require_once 
XOOPS_ROOT_PATH '/api-allocine/api-allocine-helper.php';
global 
$xoopsModule$xtubemyts$xoopsModuleConfig;
    
    echo 
'<h1>' _MD_XTUBE_ALLOFORM_TITLE '</h1>';
?>
<html><div class="xoopstube_cadreblock" style="overflow: auto; margin-left: 5%; margin-right: 5%;"></html>
<?php
        $helper  
= new AlloHelper;

    function 
removeAccents($title)
        {
        
$accentued = array("à","á","â","ã","ä","ç","è","é","ê","ë","ì",
        
"í","î","ï","ñ","ò","ó","ô","õ","ö","ù","ú","û","ü","ý","ÿ",
        
"À","Á","Â","Ã","Ä","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ñ","Ò",
        
"Ó","Ô","Õ","Ö","Ù","Ú","Û","Ü","Ý","'",",","!","?",".",":","&","-","_");
        
$nonaccentued = array("a","a","a","a","a","c","e","e","e","e","i","i",
        
"i","i","n","o","o","o","o","o","u","u","u","u","y","y","A","A","A",
        
"A","A","C","E","E","E","E","I","I","I","I","N","O","O","O","O","O",
        
"U","U","U","U","Y"," "," "," "," "," "," "," "," "," ");

        
$title str_replace($accentued$nonaccentued$title);

        return 
$title;
        }
        
    
$title $_POST['filmtitle'];
    
$q removeAccents($title);
    
$page 1;
    
$count 16;
    
    
//$filter = array('movie');
    
$profile 'small';
    
if (isset(
$_POST['submit'])) {
    try {
        
// Envoi de la requête
        
$arrayMovie   $helper->search($q$page$count)->getArray();
        
//print_r($arrayMovie);
            
if (isset($arrayMovie['movie'])) {
                
$nombreResult $arrayMovie['results'][1]['$'];
                echo 
"<div class='xo-pagact' style='display: inline-block;'><b>$nombreResult résultat(s) de film(s) pour <font color='orange'>$q</font></b></div><br>";
                foreach (
$arrayMovie['movie'] as $key) {
                if (isset(
$key['title'])) {
                echo 
"<div class='xoopstube_descrblock' style='display: block; float: left; width: 190px; margin: 5px;margin-bottom: 20px; padding: 2px; font-size: 90%; text-align: center;'><span><img src=",$key['poster']," style='width: 190px; height: 260px; align: left;'></img></span>
                <span><font style='color: orange;'>" 
.$key['title']."</font><br />
                <form action='submit_film.php' method='POST'>
                <input type='hidden' value="
.$key['code']." name='filmcode'>
                <input type='submit' value='Selectionner'>
                </form></span></div>"
;
                
                }
                    else {
                        
$titreor $key['originalTitle'];
                        echo 
$key['originalTitle'] . "<br />";
                    }
                }
            }
?>
<html></div></html>
<html><div class="xoopstube_cadreblock" style="overflow: auto; margin-left: 5%; margin-right: 5%; margin-top: 10px;"></html>
<?php            
            
if (isset($arrayMovie['tvseries'])) {
                
$nombreResultSerie $arrayMovie['results'][4]['$'];
                echo 
"<div class='xo-pagact' style='display: inline-block;'><b><font color='orange'> $nombreResultSerie</font> résultat(s) pour les séries </b></div><br>";
                foreach (
$arrayMovie['tvseries'] as $key) {
                if (isset(
$key['originalTitle']))
                echo 
"<div class='xoopstube_descrblock' style='display: block; float: left; width: 190px; margin: 5px;margin-bottom: 20px; padding: 2px; font-size: 90%; text-align: center;'><span><img src=",$key['poster']['href']," style='width: 190px; height: 260px; align: left;'></img></span>
                <span><font style='color: orange;'>" 
.$key['originalTitle']."</font><br />
                <form action='submit_serie.php' method='POST'>
                <input type='hidden' value="
.$key['code']." name='seriecode'>
                <input type='submit' value='Selectionner'>
                </form></span></div>"
;
                
                
                    else{
                        echo 
$key['originalTitle'] . "<br>";
                        }
                }
            }
        }
       
    catch (
ErrorException $error) {
        
// En cas d'erreur
        
echo "Erreur n°"$error->getCode(), ": "$error->getMessage(), PHP_EOL;
    }
}else{
    echo 
"pas de résultat";
}    
   
?>
<html></div></html>
<?php


$xoopsTpl
->assign('module_dir'$xoopsModule->getVar('dirname'));
include 
XOOPS_ROOT_PATH '/footer.php';    
?>

résultat:
http://nsm08.casimages.com/img/2015/0 ... 071210071137512855362.png

Enfin les deux fichiers qui vont servir à récupérer les données, les transformer et les inclure automatiquement dans le formulaire de soumission de nouveau lien, il ne reste plus qu'a mettre le code du lien en question.

submit_film.php
<?php
/**
 * $Id: submit_film.php
 * Module: XoopsTube
 */

include 'header.php';
include 
XOOPS_ROOT_PATH '/header.php';
include 
XOOPS_ROOT_PATH '/class/xoopsformloader.php';

$mytree = new XoopsTree($xoopsDB->prefix('xoopstube_cat'), 'cid''pid');

global 
$xoopsModule$xtubemyts$xoopsModuleConfig;

$xoopsTpl->assign(
    
'xoops_module_header''<link rel="stylesheet" type="text/css" href="' xoopstube_url '/xtubestyle.css" />'
);

$cid intval(xtube_cleanRequestVars($_REQUEST'cid'0));
$lid intval(xtube_cleanRequestVars($_REQUEST'lid'0));

if (
FALSE == xtube_checkgroups($cid'XTubeSubPerm')) {
    
redirect_header('index.php'1_MD_XTUBE_NOPERMISSIONTOPOST);
    exit();
}

if (
TRUE == xtube_checkgroups($cid'XTubeSubPerm')) {
    if (
xtube_cleanRequestVars($_REQUEST'submit'0)) {
        if (
FALSE == xtube_checkgroups($cid'XTubeSubPerm')) {
            
redirect_header('index.php'1_MD_XTUBE_NOPERMISSIONTOPOST);
            exit();
        }

        
$submitter    = (is_object($xoopsUser) && !empty($xoopsUser)) ? $xoopsUser->getVar('uid') : 0;
        
$vidsource    xtube_cleanRequestVars($_REQUEST'vidsource'0);
        
$offline      xtube_cleanRequestVars($_REQUEST'offline'0);
        
$notifypub    xtube_cleanRequestVars($_REQUEST'notifypub'0);
        
$approve      xtube_cleanRequestVars($_REQUEST'approve'0);
        
$vidrating    xtube_cleanRequestVars($_REQUEST'vidrating'0);
        
$vidid        $xtubemyts->addslashes(ltrim($_POST['vidid']));
        
$title        $xtubemyts->addslashes(ltrim($_REQUEST['title']));
        
$descriptionb $xtubemyts->addslashes(ltrim($_REQUEST['descriptionb']));
        
$publisher    $xtubemyts->addslashes(trim($_REQUEST['publisher']));
        
$time         $xtubemyts->addslashes(ltrim($_REQUEST['time']));
        
$keywords     $xtubemyts->addslashes(trim($_REQUEST['keywords']));
        
$item_tag     $xtubemyts->addslashes(ltrim($_REQUEST['item_tag']));
        
$picurl       $xtubemyts->addslashes(ltrim($_REQUEST['picurl']));
        
$date         time();
        
$publishdate  0;
        
$ipaddress    $_SERVER['REMOTE_ADDR'];

        if (
$lid == 0) {
            
$status      0;
            
$publishdate 0;
            
$message     _MD_XTUBE_THANKSFORINFO;
            if (
TRUE == xtube_checkgroups($cid'XTubeAutoApp')) {
                
$publishdate time();
                
$status      1;
                
$message     _MD_XTUBE_ISAPPROVED;
            }
            
$sql 'INSERT INTO ' $xoopsDB->prefix('xoopstube_videos')
                . 
'    (lid, cid, title, vidid, submitter, publisher, status, date, hits, rating, votes, comments, vidsource, published, expired, offline, description, ipaddress, notifypub, vidrating, time, keywords, item_tag, picurl) ';
            
$sql .= " VALUES     ('', $cid, '$title', '$vidid', '$submitter', '$publisher', '$status', '$date', 0, 0, 0, 0, '$vidsource', '$publishdate', 0, '$offline', '$descriptionb', '$ipaddress', '$notifypub', '$vidrating', '$time', '$keywords', '$item_tag', '$picurl')";
            if (!
$result $xoopsDB->query($sql)) {
                
$_error $xoopsDB->error() . ' : ' $xoopsDB->errno();
                
XoopsErrorHandler_HandleError(E_USER_WARNING$_error__FILE____LINE__);
            }
            
$newid mysql_insert_id();

// Add item_tag to Tag-module
            
if ($lid == 0) {
                
$tagupdate xtube_tagupdate($newid$item_tag);
            } else {
                
$tagupdate xtube_tagupdate($lid$item_tag);
            }

// Notify of new link (anywhere) and new link in category
            
$notification_handler = &xoops_gethandler('notification');

            
$tags               = array();
            
$tags['VIDEO_NAME'] = $title;
            
$tags['VIDEO_URL']
                                =
                
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' $cid '&amp;lid='
                    
$newid;

            
$sql    'SELECT title FROM ' $xoopsDB->prefix('xoopstube_cat') . ' WHERE cid=' $cid;
            
$result $xoopsDB->query($sql);
            
$row    $xoopsDB->fetchArray($result);

            
$tags['CATEGORY_NAME'] = $row['title'];
            
$tags['CATEGORY_URL']
                                   =
                
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' $cid;
            if (
TRUE == xtube_checkgroups($cid'XTubeAutoApp')) {
                
$notification_handler->triggerEvent('global'0'new_video'$tags);
                
$notification_handler->triggerEvent('category'$cid'new_video'$tags);
                
redirect_header('index.php'2_MD_XTUBE_ISAPPROVED);
            } else {
                
$tags['WAITINGFILES_URL']
                    = 
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/admin/newvideos.php';
                
$notification_handler->triggerEvent('global'0'video_submit'$tags);
                
$notification_handler->triggerEvent('category'$cid'video_submit'$tags);
                if (
$notifypub) {
                    include_once 
XOOPS_ROOT_PATH '/include/notification_constants.php';
                    
$notification_handler->subscribe('video'$newid'approve'XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
                }
                
redirect_header('index.php'2_MD_XTUBE_THANKSFORINFO);
            }
        } else {
            if (
TRUE == xtube_checkgroups($cid'XTubeAutoApp') || $approve == 1) {
                
$updated time();
                
$sql     "UPDATE " $xoopsDB->prefix('xoopstube_videos')
                    . 
" SET cid=$cid, title='$title', vidid='$vidid', publisher='$publisher', updated='$updated', offline='$offline', description='$descriptionb', ipaddress='$ipaddress', notifypub='$notifypub', vidrating='$vidrating', time='$time', keywords='$keywords', item_tag='$item_tag', picurl='$picurl' WHERE lid ="
                    
$lid;
                if (!
$result $xoopsDB->query($sql)) {
                    
$_error $xoopsDB->error() . " : " $xoopsDB->errno();
                    
XoopsErrorHandler_HandleError(E_USER_WARNING$_error__FILE____LINE__);
                }

                
$notification_handler = &xoops_gethandler('notification');
                
$tags                 = array();
                
$tags['VIDEO_NAME']   = $title;
                
$tags['VIDEO_URL']
                                      =
                    
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' $cid
                        
'&amp;lid=' $lid;
                
$sql
                                       
=
                    
"SELECT title FROM " $xoopsDB->prefix('xoopstube_cat') . " WHERE cid=" $cid;
                
$result                $xoopsDB->query($sql);
                
$row                   $xoopsDB->fetchArray($result);
                
$tags['CATEGORY_NAME'] = $row['title'];
                
$tags['CATEGORY_URL']
                                       =
                    
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' $cid;

                
$notification_handler->triggerEvent('global'0'new_video'$tags);
                
$notification_handler->triggerEvent('category'$cid'new_video'$tags);
                
$_message _MD_XTUBE_ISAPPROVED;
            } else {
                
$submitter_array $xoopsDB->fetchArray(
                    
$xoopsDB->query(
                        
'SELECT submitter FROM ' $xoopsDB->prefix('xoopstube_videos') . ' WHERE lid=' intval($lid)
                    )
                );
                
$modifysubmitter $xoopsUser->uid();
                
$requestid       $modifysubmitter;
                
$requestdate     time();
                
$updated         xtube_cleanRequestVars($_REQUEST'up_dated'time());
                if (
$modifysubmitter == $submitter_array['submitter']) {
                    
$sql 'INSERT INTO ' $xoopsDB->prefix('xoopstube_mod')
                        . 
' (requestid, lid, cid, title, vidid, publisher, vidsource, description, modifysubmitter, requestdate, time, keywords, item_tag, picurl)';
                    
$sql .= " VALUES ('', $lid$cid, '$title', '$vidid', '$publisher', '$vidsource', '$descriptionb', '$modifysubmitter', '$requestdate', '$time', '$keywords', '$item_tag', '$picurl')";
                    if (!
$result $xoopsDB->query($sql)) {
                        
$_error $xoopsDB->error() . " : " $xoopsDB->errno();
                        
XoopsErrorHandler_HandleError(E_USER_WARNING$_error__FILE____LINE__);
                    }
                } else {
                    
redirect_header('index.php'2_MD_XTUBE_MODIFYNOTALLOWED);
                }

                
$tags = array();
                
$tags['MODIFYREPORTS_URL']
                                      =
                    
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/admin/index.php?op=listModReq';
                
$notification_handler = &xoops_gethandler('notification');
                
$notification_handler->triggerEvent('global'0'video_modify'$tags);

                
$tags['WAITINGFILES_URL']
                    = 
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/admin/index.php?op=listNewvideos';
                
$notification_handler->triggerEvent('global'0'video_submit'$tags);
                
$notification_handler->triggerEvent('category'$cid'video_submit'$tags);
                if (
$notifypub) {
                    include_once 
XOOPS_ROOT_PATH '/include/notification_constants.php';
                    
$notification_handler->subscribe('video'$newid'approve'XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
                }
                
$_message _MD_XTUBE_THANKSFORINFO;
            }
            
redirect_header('index.php'2$_message);
        }
    } else {
        global 
$xoopsModuleConfig;

        
$approve xtube_cleanRequestVars($_REQUEST'approve'0);

// Show disclaimer
        
if ($xoopsModuleConfig['showdisclaimer'] && !isset($_GET['agree']) && $approve == 0) {
            echo 
'<br /><div style="text-align: center;">' xtube_imageheader() . '</div><br />';
            echo 
'<h4>' _MD_XTUBE_DISCLAIMERAGREEMENT '</h4>';
            echo 
'<div>' $xtubemyts->displayTarea($xoopsModuleConfig['disclaimer'], 11111) . '</div>';
            echo 
'<form action="submit.php" method="post">';
            echo 
'<div style="text-align: center;">' _MD_XTUBE_DOYOUAGREE '</b><br /><br />';
            echo
'<input type="button" onclick="location='submit.php?agree=1'" class="formButton" value="'
                
_MD_XTUBE_AGREE '" alt="' _MD_XTUBE_AGREE '" />';
            echo 
'&nbsp;';
            echo
'<input type="button" onclick="location='index.php'" class="formButton" value="' _CANCEL '" alt="'
                
_CANCEL '" />';
            echo 
'</div></form>';
            include 
XOOPS_ROOT_PATH '/footer.php';
            exit();
        }
        echo 
'<br /><div style="text-align: center;">' xtube_imageheader() . '</div><br />';
        echo 
'<div>' _MD_XTUBE_SUB_SNEWMNAMEDESC '</div>';
//        echo "<div class='xoopstube_singletitle'>" . _MD_XTUBE_SUBMITCATHEAD . "</div>n";
 
    //récupération infos allociné et autocompletion
    
require_once XOOPS_ROOT_PATH '/api-allocine/api-allocine-helper.php';
    
   
// Créer l'objet
    
$helper = new AlloHelper;

    
//Pour plus de clareté, on définit les paramètres à l'avance: le code du film, et la quantité d'informations à récupérer.

    
$code $_POST['filmcode'];
    
$profile 'medium';
    
$filter 'movie';
    
    
//Ensuite, il est conseillé d'effectuer des requêtes dans un bloc try{} catch(){} pour gérer les erreurs.
if(isset($_POST['filmcode'])) {
    try
    {
        
// Envoi de la requête
        
$data $helper->movie$code$profile$filter );
        
//print_r($data->getArray());
        
        //Convertir la durée en hh:mm:ss
        
$total $data->runtime//Nombre de secondes
        
$heure intval(abs($total 3600));
        
$total $total - ($heure 3600);
        
$minute intval(abs($total 60));
        
$total $total - ($minute 60);
        
$seconde $total;
        
        
//Convertir la date en jj.mm.aa
        
$date $data->release['releaseDate'];
        function 
datefr($date) { 
        
$split split("-",$date); 
        
$annee $split[0]; 
        
$mois $split[1]; 
        
$jour $split[2]; 
        return 
"$jour"."-"."$mois"."-"."$annee"


        
$date $data->release['releaseDate'];; // Date format américain
        // $date=date("Y-m-d"); // Ou date du jour

    
}
    catch( 
ErrorException $error )
    {
        
// En cas d'erreur
        
echo "Erreur n°"$error->getCode(), ": "$error->getMessage(), PHP_EOL;
    }
    
    
    
$url_img $data->poster;
    
$titre $data->title;
    
$annee $data->productionYear;
    
$duree $data->runtime;
    
$date_sortie $data->release['releaseDate'];
    
$nom_realisateur $data->castingShort['directors'];
    
$synopsis $data->synopsis;
    
$nom_acteur $data->castingShort['actors'];
    
$nom_pays $data->nationality[0]['$'];
    
$bande_a $data->trailerEmbed;
    
$ba_href $data->trailer['href'];
    
$nom_genre $data->genre[0]['$'];
    
$nom_genre2 $data->genre[1]['$'];
    
$nom_genre3 $data->genre[2]['$'];
    
    function 
removespace($nom_genre)
        {
        
$spaced = array("Arts Martiaux","Comédie dramatique","Comédie musicale","Science fiction");
        
$nonspaced = array("Arts-Martiaux","Comédie-dramatique","Comédie-musicale","Science-fiction");

        
$nom_genre str_replace($spaced$nonspaced$nom_genre);

        return 
$nom_genre;
        }
    
$nom_genre removespace($nom_genre);
    
$nom_genre2 removespace($nom_genre2);
    
$nom_genre3 removespace($nom_genre3);
    
    
$descrip '' $synopsis .'<br /><br />Date de production ' $annee '('.$heure.'h'.$minute.'min)<br />Réalisé par ' $nom_realisateur '<br />Avec ' $nom_acteur '<br />Genre ' $nom_genre ' ' $nom_genre2 '<br />Nationalité ' $nom_pays '<br /><div id="demo"><span class="cutout"><img src="' $url_img '" style="width: 243px; height: 363px;"></img></span><br /><br /><a href="' $ba_href '" class="zoombox w600% h340%" title="Bande annonce : ' $titre '"><img src="/streaming/images/icon/trailer.png" alt="/streaming/images/icon/trailer.png" class="decoded" style="border: medium none;"></a></img></div><br />';
}
       
$sql         'SELECT * FROM ' $xoopsDB->prefix('xoopstube_videos') . ' WHERE lid=' intval($lid);
        
$video_array $xoopsDB->fetchArray($xoopsDB->query($sql));

        
$lid          $video_array['lid'] ? $video_array['lid'] : 0;
        
$cid          $video_array['cid'] ? $video_array['cid'] : 2;
        
$title        $video_array['title'] ? $xtubemyts->htmlSpecialChars($video_array['title']) : $xtubemyts->htmlSpecialChars($data->title).' [FilmFR]';
        
$vidid        $video_array['vidid'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['vidid']) : '';
        
$publisher    $video_array['publisher'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['publisher']) : '' $xoopsUser->getVar('uname') . '';
        
$screenshot   $video_array['screenshot'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['screenshot']) : '';
        
$descriptionb $video_array['description'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['description']) : ''.$descrip.'';
        
$published    $video_array['published'] ? $video_array['published'] : 0;
        
$expired      $video_array['expired'] ? $video_array['expired'] : 0;
        
$updated      $video_array['updated'] ? $video_array['updated'] : 0;
        
$offline      $video_array['offline'] ? $video_array['offline'] : 0;
        
$vidsource    $video_array['vidsource'] ? $video_array['vidsource'] : 0;
        
$ipaddress    $video_array['ipaddress'] ? $video_array['ipaddress'] : 0;
        
$notifypub    $video_array['notifypub'] ? $video_array['notifypub'] : 0;
        
$vidrating    $video_array['vidrating'] ? $video_array['vidrating'] : 1;
        
$time         $video_array['time'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['time']) : ''.$heure.'h'.$minute.'min';
        
$keywords     $video_array['keywords'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['keywords']) : '';
        
$item_tag     $video_array['item_tag'] ? $video_array['item_tag'] : $video_array['item_tag'] = $nom_genre ' ' $nom_genre2 ' ' $nom_genre3;
        
$picurl       $video_array['picurl'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['picurl']) : '';
        
        
$sform = new XoopsThemeForm(_MD_XTUBE_SUBMITCATHEAD'storyform'xoops_getenv('PHP_SELF'));
        
$sform->setExtra('enctype="multipart/form-data"');

        
xoopstube_noindexnofollow();

// Video title form
        
$sform->addElement(new XoopsFormText(_MD_XTUBE_FILETITLE'title'70255$title), TRUE);

// Video source form
        
$vidsource_array  = array(
            
0   => _MD_XTUBE_YOUTUBE,
            
1   => _MD_XTUBE_METACAFE,
            
2   => _MD_XTUBE_IFILM,
            
4   => _MD_XTUBE_VIDDLER,
            
100 => _MD_XTUBE_GOOGLEVIDEO,
            
101 => _MD_XTUBE_MYSPAVETV,
            
102 => _MD_XTUBE_DAILYMOTION,
            
103 => _MD_XTUBE_BLIPTV,
            
104 => _MD_XTUBE_CLIPFISH,
            
105 => _MD_XTUBE_LIVELEAK,
            
106 => _MD_XTUBE_MAKTOOB,
            
107 => _MD_XTUBE_VEOH,
            
108 => _MD_XTUBE_VIMEO,
            
109 => _MD_XTUBE_RUTUBE,
            
110 => _MD_XTUBE_STAGEVU,
            
111 => _MD_XTUBE_NETU,
            
112 => _MD_XTUBE_MAILRU,
            
113 => _MD_XTUBE_EXASHARE,
            
114 => _MD_XTUBE_VK,
            
115 => _MD_XTUBE_VIDEOMEGA,
            
116 => _MD_XTUBE_SPEEDVIDEO,
            
117 => _MD_XTUBE_WAT,
            
118 => _MD_XTUBE_KIWI,
            
119 => _MD_XTUBE_VODLOCKER,
            
//120 => _MD_XTUBE_UPTOSTREAM,
            //121 => _MD_XTUBE_AXAVID,
        
);
        
$vidsource_select = new XoopsFormSelect(_MD_XTUBE_VIDSOURCE'vidsource'$vidsource);
        
$vidsource_select->addOptionArray($vidsource_array);
        
$sform->addElement($vidsource_selectFALSE);

// Video code form
        
$videocode = new XoopsFormText(_MD_XTUBE_DLVIDID'vidid'70512$vidid);
        
$videocode->setDescription('<br /><small>' _MD_XTUBE_VIDEO_DLVIDIDDSC '</small>');
        
$sform->addElement($videocodeTRUE);
        
$sform->addElement(new XoopsFormLabel(''_MD_XTUBE_VIDEO_DLVIDID_NOTE));

// Picture url form
        
$picurl = new XoopsFormText(_MD_XTUBE_VIDEO_PICURL'picurl'70255$picurl);
        
$picurl->setDescription('<br /><span style="font-weight: normal;">' _MD_XTUBE_VIDEO_PICURLNOTE '</span>');
        
$sform->addElement($picurlFALSE);

// Video publisher form
        
$sform->addElement(new XoopsFormText(_MD_XTUBE_VIDEO_PUBLISHER'publisher'70255$publisher), TRUE);

// Category tree
        
$mytree = new XoopsTree($xoopsDB->prefix('xoopstube_cat'), 'cid''pid');

        
$submitcats = array();
        
$sql        'SELECT * FROM ' $xoopsDB->prefix('xoopstube_cat') . ' ORDER BY title';
        
$result     $xoopsDB->query($sql);
        while (
$myrow $xoopsDB->fetchArray($result)) {
            if (
TRUE == xtube_checkgroups($myrow['cid'], 'XTubeSubPerm')) {
                
$submitcats[$myrow['cid']] = $myrow['title'];
            }
        }

// Video time form
        
$timeform = new XoopsFormText(_MD_XTUBE_TIME'time'77$time);
        
$timeform->setDescription('<small>(h:mm:ss)</small>');
        
$sform->addElement($timeformFALSE);

// Video category form
        
ob_start();
        
$mytree->makeMySelBox('title''title'$cid0);
        
$sform->addElement(new XoopsFormLabel(_MD_XTUBE_CATEGORYCob_get_contents()));
        
ob_end_clean();

// Video description form
//        $editor = xtube_getWysiwygForm( _MD_XTUBE_DESCRIPTIONC, 'descriptionb', $descriptionb, 10, 50, '');
//        $sform -> addElement( $editor, true );

        
$optionsTrayNote = new XoopsFormElementTray(_MD_XTUBE_DESCRIPTIONC'<br />');
        if (
class_exists('XoopsFormEditor')) {
            
$options['name']   = 'descriptionb';
            
$options['value']  = $descriptionb;
            
$options['rows']   = 7;
            
$options['cols']   = 100;
            
$options['width']  = '100%';
            
$options['height'] = '200px';
            
$editor            = new XoopsFormEditor(''$xoopsModuleConfig['form_optionsuser'], $options$nohtml FALSE$onfailure 'textarea');
            
$optionsTrayNote->addElement($editor);
        } else {
            
$editor = new XoopsFormDhtmlTextArea('''descriptionb'$item->getVar('descriptionb''e'), '100%''100%');
            
$optionsTrayNote->addElement($editor);
        }

        
$sform->addElement($optionsTrayNoteFALSE);

        if (
$xoopsModuleConfig['usercantag'] == 1) {
// Insert tags if Tag-module is installed
            
if (xtube_tag_module_included()) {
                include_once 
XOOPS_ROOT_PATH '/modules/tag/include/formtag.php';
                
$text_tags = new XoopsFormTag('item_tag'70255$video_array['item_tag'], 0);
                
$sform->addElement($text_tags);
            }
        } else {
            
$sform->addElement(new XoopsFormHidden('item_tag'$video_array['item_tag']));
        }

        
$submitter2 = (is_object($xoopsUser) && !empty($xoopsUser)) ? $xoopsUser->getVar('uid') : 0;
        if (
$submitter2 0) {
            
$option_tray = new XoopsFormElementTray(_MD_XTUBE_OPTIONS'<br />');

            if (!
$approve) {
                
$notify_checkbox = new XoopsFormCheckBox('''notifypub');
                
$notify_checkbox->addOption(1_MD_XTUBE_NOTIFYAPPROVE);
                
$option_tray->addElement($notify_checkbox);
            } else {
                
$sform->addElement(new XoopsFormHidden('notifypub'0));
            }
        }

        if (
TRUE == xtube_checkgroups($cid'XTubeAppPerm') && $lid 0) {
            
$approve_checkbox = new XoopsFormCheckBox('''approve'$approve);
            
$approve_checkbox->addOption(1_MD_XTUBE_APPROVE);
            
$option_tray->addElement($approve_checkbox);
        } else {
            if (
TRUE == xtube_checkgroups($cid'XTubeAutoApp')) {
                
$sform->addElement(new XoopsFormHidden('approve'1));
            } else {
                
$sform->addElement(new XoopsFormHidden('approve'0));
            }
        }
        
$sform->addElement($option_tray);

        
$button_tray = new XoopsFormElementTray('''');
        
$button_tray->addElement(new XoopsFormButton('''submit'_SUBMIT'submit'));
        
$button_tray->addElement(new XoopsFormHidden('lid'$lid));

        
$sform->addElement($button_tray);
        
$sform->display();

        include 
XOOPS_ROOT_PATH '/footer.php';
    }
} else {
    
redirect_header('index.php'2_MD_XTUBE_NOPERMISSIONTOPOST);
    exit();
}
?>


et submit_serie.php:
<?php
/**
 * $Id: submit_serie.php
 * Module: XoopsTube
 */

include 'header.php';
include 
XOOPS_ROOT_PATH '/header.php';
include 
XOOPS_ROOT_PATH '/class/xoopsformloader.php';

$mytree = new XoopsTree($xoopsDB->prefix('xoopstube_cat'), 'cid''pid');

global 
$xoopsModule$xtubemyts$xoopsModuleConfig;

$xoopsTpl->assign(
    
'xoops_module_header''<link rel="stylesheet" type="text/css" href="' xoopstube_url '/xtubestyle.css" />'
);

$cid intval(xtube_cleanRequestVars($_REQUEST'cid'0));
$lid intval(xtube_cleanRequestVars($_REQUEST'lid'0));

if (
FALSE == xtube_checkgroups($cid'XTubeSubPerm')) {
    
redirect_header('index.php'1_MD_XTUBE_NOPERMISSIONTOPOST);
    exit();
}

if (
TRUE == xtube_checkgroups($cid'XTubeSubPerm')) {
    if (
xtube_cleanRequestVars($_REQUEST'submit'0)) {
        if (
FALSE == xtube_checkgroups($cid'XTubeSubPerm')) {
            
redirect_header('index.php'1_MD_XTUBE_NOPERMISSIONTOPOST);
            exit();
        }

        
$submitter    = (is_object($xoopsUser) && !empty($xoopsUser)) ? $xoopsUser->getVar('uid') : 0;
        
$vidsource    xtube_cleanRequestVars($_REQUEST'vidsource'0);
        
$offline      xtube_cleanRequestVars($_REQUEST'offline'0);
        
$notifypub    xtube_cleanRequestVars($_REQUEST'notifypub'0);
        
$approve      xtube_cleanRequestVars($_REQUEST'approve'0);
        
$vidrating    xtube_cleanRequestVars($_REQUEST'vidrating'0);
        
$vidid        $xtubemyts->addslashes(ltrim($_POST['vidid']));
        
$title        $xtubemyts->addslashes(ltrim($_REQUEST['title']));
        
$descriptionb $xtubemyts->addslashes(ltrim($_REQUEST['descriptionb']));
        
$publisher    $xtubemyts->addslashes(trim($_REQUEST['publisher']));
        
$time         $xtubemyts->addslashes(ltrim($_REQUEST['time']));
        
$keywords     $xtubemyts->addslashes(trim($_REQUEST['keywords']));
        
$item_tag     $xtubemyts->addslashes(ltrim($_REQUEST['item_tag']));
        
$picurl       $xtubemyts->addslashes(ltrim($_REQUEST['picurl']));
        
$date         time();
        
$publishdate  0;
        
$ipaddress    $_SERVER['REMOTE_ADDR'];

        if (
$lid == 0) {
            
$status      0;
            
$publishdate 0;
            
$message     _MD_XTUBE_THANKSFORINFO;
            if (
TRUE == xtube_checkgroups($cid'XTubeAutoApp')) {
                
$publishdate time();
                
$status      1;
                
$message     _MD_XTUBE_ISAPPROVED;
            }
            
$sql 'INSERT INTO ' $xoopsDB->prefix('xoopstube_videos')
                . 
'    (lid, cid, title, vidid, submitter, publisher, status, date, hits, rating, votes, comments, vidsource, published, expired, offline, description, ipaddress, notifypub, vidrating, time, keywords, item_tag, picurl) ';
            
$sql .= " VALUES     ('', $cid, '$title', '$vidid', '$submitter', '$publisher', '$status', '$date', 0, 0, 0, 0, '$vidsource', '$publishdate', 0, '$offline', '$descriptionb', '$ipaddress', '$notifypub', '$vidrating', '$time', '$keywords', '$item_tag', '$picurl')";
            if (!
$result $xoopsDB->query($sql)) {
                
$_error $xoopsDB->error() . ' : ' $xoopsDB->errno();
                
XoopsErrorHandler_HandleError(E_USER_WARNING$_error__FILE____LINE__);
            }
            
$newid mysql_insert_id();

// Add item_tag to Tag-module
            
if ($lid == 0) {
                
$tagupdate xtube_tagupdate($newid$item_tag);
            } else {
                
$tagupdate xtube_tagupdate($lid$item_tag);
            }

// Notify of new link (anywhere) and new link in category
            
$notification_handler = &xoops_gethandler('notification');

            
$tags               = array();
            
$tags['VIDEO_NAME'] = $title;
            
$tags['VIDEO_URL']
                                =
                
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' $cid '&amp;lid='
                    
$newid;

            
$sql    'SELECT title FROM ' $xoopsDB->prefix('xoopstube_cat') . ' WHERE cid=' $cid;
            
$result $xoopsDB->query($sql);
            
$row    $xoopsDB->fetchArray($result);

            
$tags['CATEGORY_NAME'] = $row['title'];
            
$tags['CATEGORY_URL']
                                   =
                
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' $cid;
            if (
TRUE == xtube_checkgroups($cid'XTubeAutoApp')) {
                
$notification_handler->triggerEvent('global'0'new_video'$tags);
                
$notification_handler->triggerEvent('category'$cid'new_video'$tags);
                
redirect_header('index.php'2_MD_XTUBE_ISAPPROVED);
            } else {
                
$tags['WAITINGFILES_URL']
                    = 
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/admin/newvideos.php';
                
$notification_handler->triggerEvent('global'0'video_submit'$tags);
                
$notification_handler->triggerEvent('category'$cid'video_submit'$tags);
                if (
$notifypub) {
                    include_once 
XOOPS_ROOT_PATH '/include/notification_constants.php';
                    
$notification_handler->subscribe('video'$newid'approve'XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
                }
                
redirect_header('index.php'2_MD_XTUBE_THANKSFORINFO);
            }
        } else {
            if (
TRUE == xtube_checkgroups($cid'XTubeAutoApp') || $approve == 1) {
                
$updated time();
                
$sql     "UPDATE " $xoopsDB->prefix('xoopstube_videos')
                    . 
" SET cid=$cid, title='$title', vidid='$vidid', publisher='$publisher', updated='$updated', offline='$offline', description='$descriptionb', ipaddress='$ipaddress', notifypub='$notifypub', vidrating='$vidrating', time='$time', keywords='$keywords', item_tag='$item_tag', picurl='$picurl' WHERE lid ="
                    
$lid;
                if (!
$result $xoopsDB->query($sql)) {
                    
$_error $xoopsDB->error() . " : " $xoopsDB->errno();
                    
XoopsErrorHandler_HandleError(E_USER_WARNING$_error__FILE____LINE__);
                }

                
$notification_handler = &xoops_gethandler('notification');
                
$tags                 = array();
                
$tags['VIDEO_NAME']   = $title;
                
$tags['VIDEO_URL']
                                      =
                    
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' $cid
                        
'&amp;lid=' $lid;
                
$sql
                                       
=
                    
"SELECT title FROM " $xoopsDB->prefix('xoopstube_cat') . " WHERE cid=" $cid;
                
$result                $xoopsDB->query($sql);
                
$row                   $xoopsDB->fetchArray($result);
                
$tags['CATEGORY_NAME'] = $row['title'];
                
$tags['CATEGORY_URL']
                                       =
                    
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' $cid;

                
$notification_handler->triggerEvent('global'0'new_video'$tags);
                
$notification_handler->triggerEvent('category'$cid'new_video'$tags);
                
$_message _MD_XTUBE_ISAPPROVED;
            } else {
                
$submitter_array $xoopsDB->fetchArray(
                    
$xoopsDB->query(
                        
'SELECT submitter FROM ' $xoopsDB->prefix('xoopstube_videos') . ' WHERE lid=' intval($lid)
                    )
                );
                
$modifysubmitter $xoopsUser->uid();
                
$requestid       $modifysubmitter;
                
$requestdate     time();
                
$updated         xtube_cleanRequestVars($_REQUEST'up_dated'time());
                if (
$modifysubmitter == $submitter_array['submitter']) {
                    
$sql 'INSERT INTO ' $xoopsDB->prefix('xoopstube_mod')
                        . 
' (requestid, lid, cid, title, vidid, publisher, vidsource, description, modifysubmitter, requestdate, time, keywords, item_tag, picurl)';
                    
$sql .= " VALUES ('', $lid$cid, '$title', '$vidid', '$publisher', '$vidsource', '$descriptionb', '$modifysubmitter', '$requestdate', '$time', '$keywords', '$item_tag', '$picurl')";
                    if (!
$result $xoopsDB->query($sql)) {
                        
$_error $xoopsDB->error() . " : " $xoopsDB->errno();
                        
XoopsErrorHandler_HandleError(E_USER_WARNING$_error__FILE____LINE__);
                    }
                } else {
                    
redirect_header('index.php'2_MD_XTUBE_MODIFYNOTALLOWED);
                }

                
$tags = array();
                
$tags['MODIFYREPORTS_URL']
                                      =
                    
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/admin/index.php?op=listModReq';
                
$notification_handler = &xoops_gethandler('notification');
                
$notification_handler->triggerEvent('global'0'video_modify'$tags);

                
$tags['WAITINGFILES_URL']
                    = 
XOOPS_URL '/modules/' $xoopsModule->getVar('dirname') . '/admin/index.php?op=listNewvideos';
                
$notification_handler->triggerEvent('global'0'video_submit'$tags);
                
$notification_handler->triggerEvent('category'$cid'video_submit'$tags);
                if (
$notifypub) {
                    include_once 
XOOPS_ROOT_PATH '/include/notification_constants.php';
                    
$notification_handler->subscribe('video'$newid'approve'XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
                }
                
$_message _MD_XTUBE_THANKSFORINFO;
            }
            
redirect_header('index.php'2$_message);
        }
    } else {
        global 
$xoopsModuleConfig;

        
$approve xtube_cleanRequestVars($_REQUEST'approve'0);

// Show disclaimer
        
if ($xoopsModuleConfig['showdisclaimer'] && !isset($_GET['agree']) && $approve == 0) {
            echo 
'<br /><div style="text-align: center;">' xtube_imageheader() . '</div><br />';
            echo 
'<h4>' _MD_XTUBE_DISCLAIMERAGREEMENT '</h4>';
            echo 
'<div>' $xtubemyts->displayTarea($xoopsModuleConfig['disclaimer'], 11111) . '</div>';
            echo 
'<form action="submit.php" method="post">';
            echo 
'<div style="text-align: center;">' _MD_XTUBE_DOYOUAGREE '</b><br /><br />';
            echo
'<input type="button" onclick="location='submit.php?agree=1'" class="formButton" value="'
                
_MD_XTUBE_AGREE '" alt="' _MD_XTUBE_AGREE '" />';
            echo 
'&nbsp;';
            echo
'<input type="button" onclick="location='index.php'" class="formButton" value="' _CANCEL '" alt="'
                
_CANCEL '" />';
            echo 
'</div></form>';
            include 
XOOPS_ROOT_PATH '/footer.php';
            exit();
        }
        echo 
'<br /><div style="text-align: center;">' xtube_imageheader() . '</div><br />';
        echo 
'<div>' _MD_XTUBE_SUB_SNEWMNAMEDESC '</div>';
//        echo "<div class='xoopstube_singletitle'>" . _MD_XTUBE_SUBMITCATHEAD . "</div>n";
 
    //récupération infos allociné et autocompletion
    
require_once XOOPS_ROOT_PATH '/api-allocine/api-allocine-helper.php';
    
   
// Créer l'objet
    
$helper = new AlloHelper;

    
//Pour plus de clareté, on définit les paramètres à l'avance: le code du film, et la quantité d'informations à récupérer.

    
$code $_POST['seriecode'];
    
$profile 'medium';
    
$filter = array('tvseries');
    
//Ensuite, il est conseillé d'effectuer des requêtes dans un bloc try{} catch(){} pour gérer les erreurs.
if(isset($_POST['seriecode'])) {
    try
    {
        
// Envoi de la requête
        
$data $helper->tvserie$code$profile$filter);
        
//print_r($data->getArray());
        
        //Convertir la date en jj.mm.aa
        
$date $data->originalBroadcast['dateStart'];
        function 
datefr($date) { 
        
$split split("-",$date); 
        
$annee $split[0]; 
        
$mois $split[1]; 
        
$jour $split[2]; 
        return 
"$jour"."-"."$mois"."-"."$annee"


        
$date $data->originalBroadcast['dateStart']; // Date format américain
        // $date=date("Y-m-d"); // Ou date du jour

    
}
    catch( 
ErrorException $error )
    {
        
// En cas d'erreur
        
echo "Erreur n°"$error->getCode(), ": "$error->getMessage(), PHP_EOL;
    }
    
    
    
$url_img $xtubemyts->addslashes(ltrim($data->poster['href']));
    
$titre $xtubemyts->addslashes(ltrim($data->title));
    
$annee $xtubemyts->addslashes(ltrim($data->productionYear));
    
$duree $data->formatTime;
    
$date_début $xtubemyts->addslashes(ltrim($data->originalBroadcast['dateStart']));
    
$nom_realisateur $xtubemyts->addslashes(ltrim($data->castingShort['creators']));
    
$synopsis $xtubemyts->addslashes(ltrim($data->synopsis));
    
$nom_acteur $xtubemyts->addslashes(ltrim($data->castingShort['actors']));
    
$nom_pays $xtubemyts->addslashes(ltrim($data->nationality[0]['$']));
    
$bande_a $xtubemyts->addslashes(ltrim($data->trailerEmbed));
    
$nom_genre $data->genre[0]['$'];
    
$nom_genre2 $data->genre[1]['$'];
    
    function 
removespace($nom_genre)
        {
        
$spaced = array("Arts Martiaux","Comédie dramatique","Comédie musicale","Science fiction");
        
$nonspaced = array("Arts-Martiaux","Comédie-dramatique","Comédie-musicale","Science-fiction");

        
$nom_genre str_replace($spaced$nonspaced$nom_genre);

        return 
$nom_genre;
        }
    
$nom_genre removespace($nom_genre);
    
$nom_genre2 removespace($nom_genre2);
    
    
$descrip '' $data->synopsis .'<br /><br />Première diffusion ' $data->productionYear '('.$duree.'min)<br />Réalisé par ' $nom_realisateur '<br />Avec ' $nom_acteur '<br />Genre ' $nom_genre ' ' $nom_genre2 '<br />Nationalité ' $nom_pays '<br /><div id="demo"><span class="cutout"><img src="' $url_img '" style="width: 243px; height: 363px;"></img></span><br /><br /><a href="' $data->trailer[href] . '" class="zoombox w600% h340%" title="Bande annonce : ' $titre '"><img src="/streaming/images/icon/trailer.png" alt="/streaming/images/icon/trailer.png" class="decoded" style="border: medium none;"></a></img></div><br />';
}
       
$sql         'SELECT * FROM ' $xoopsDB->prefix('xoopstube_videos') . ' WHERE lid=' intval($lid);
        
$video_array $xoopsDB->fetchArray($xoopsDB->query($sql));

        
$lid          $video_array['lid'] ? $video_array['lid'] : 0;
        
$cid          $video_array['cid'] ? $video_array['cid'] : 3;
        
$title        $video_array['title'] ? $xtubemyts->htmlSpecialChars($video_array['title']) : $xtubemyts->htmlSpecialChars($data->title).' S01E01 [SérieFR]';
        
$vidid        $video_array['vidid'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['vidid']) : '';
        
$publisher    $video_array['publisher'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['publisher']) : '' $xoopsUser->getVar('uname') . '';
        
$screenshot   $video_array['screenshot'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['screenshot']) : '';
        
$descriptionb $video_array['description'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['description']) : ''.$descrip.'';
        
$published    $video_array['published'] ? $video_array['published'] : 0;
        
$expired      $video_array['expired'] ? $video_array['expired'] : 0;
        
$updated      $video_array['updated'] ? $video_array['updated'] : 0;
        
$offline      $video_array['offline'] ? $video_array['offline'] : 0;
        
$vidsource    $video_array['vidsource'] ? $video_array['vidsource'] : 0;
        
$ipaddress    $video_array['ipaddress'] ? $video_array['ipaddress'] : 0;
        
$notifypub    $video_array['notifypub'] ? $video_array['notifypub'] : 0;
        
$vidrating    $video_array['vidrating'] ? $video_array['vidrating'] : 1;
        
$time         $video_array['time'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['time']) : ''.$duree.'min';
        
$keywords     $video_array['keywords'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['keywords']) : '';
        
$item_tag     $video_array['item_tag'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['item_tag']) : '';
        
$picurl       $video_array['picurl'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['picurl']) : '';

        
$sform = new XoopsThemeForm(_MD_XTUBE_SUBMITCATHEAD'storyform'xoops_getenv('PHP_SELF'));
        
$sform->setExtra('enctype="multipart/form-data"');

        
xoopstube_noindexnofollow();

// Video title form
        
$sform->addElement(new XoopsFormText(_MD_XTUBE_FILETITLE'title'70255$title), TRUE);

// Video source form
        
$vidsource_array  = array(
            
0   => _MD_XTUBE_YOUTUBE,
            
1   => _MD_XTUBE_METACAFE,
            
2   => _MD_XTUBE_IFILM,
            
4   => _MD_XTUBE_VIDDLER,
            
100 => _MD_XTUBE_GOOGLEVIDEO,
            
101 => _MD_XTUBE_MYSPAVETV,
            
102 => _MD_XTUBE_DAILYMOTION,
            
103 => _MD_XTUBE_BLIPTV,
            
104 => _MD_XTUBE_CLIPFISH,
            
105 => _MD_XTUBE_LIVELEAK,
            
106 => _MD_XTUBE_MAKTOOB,
            
107 => _MD_XTUBE_VEOH,
            
108 => _MD_XTUBE_VIMEO,
            
109 => _MD_XTUBE_RUTUBE,
            
110 => _MD_XTUBE_STAGEVU,
            
111 => _MD_XTUBE_NETU,
            
112 => _MD_XTUBE_MAILRU,
            
113 => _MD_XTUBE_EXASHARE,
            
114 => _MD_XTUBE_VK,
            
115 => _MD_XTUBE_VIDEOMEGA,
            
116 => _MD_XTUBE_SPEEDVIDEO,
            
117 => _MD_XTUBE_WAT,
            
118 => _MD_XTUBE_KIWI,
            
119 => _MD_XTUBE_VODLOCKER,
            
//120 => _MD_XTUBE_UPTOSTREAM,
            //121 => _MD_XTUBE_AXAVID,
        
);
        
$vidsource_select = new XoopsFormSelect(_MD_XTUBE_VIDSOURCE'vidsource'$vidsource);
        
$vidsource_select->addOptionArray($vidsource_array);
        
$sform->addElement($vidsource_selectFALSE);

// Video code form
        
$videocode = new XoopsFormText(_MD_XTUBE_DLVIDID'vidid'70512$vidid);
        
$videocode->setDescription('<br /><small>' _MD_XTUBE_VIDEO_DLVIDIDDSC '</small>');
        
$sform->addElement($videocodeTRUE);
        
$sform->addElement(new XoopsFormLabel(''_MD_XTUBE_VIDEO_DLVIDID_NOTE));

// Picture url form
        
$picurl = new XoopsFormText(_MD_XTUBE_VIDEO_PICURL'picurl'70255$picurl);
        
$picurl->setDescription('<br /><span style="font-weight: normal;">' _MD_XTUBE_VIDEO_PICURLNOTE '</span>');
        
$sform->addElement($picurlFALSE);

// Video publisher form
        
$sform->addElement(new XoopsFormText(_MD_XTUBE_VIDEO_PUBLISHER'publisher'70255$publisher), TRUE);

// Category tree
        
$mytree = new XoopsTree($xoopsDB->prefix('xoopstube_cat'), 'cid''pid');

        
$submitcats = array();
        
$sql        'SELECT * FROM ' $xoopsDB->prefix('xoopstube_cat') . ' ORDER BY title';
        
$result     $xoopsDB->query($sql);
        while (
$myrow $xoopsDB->fetchArray($result)) {
            if (
TRUE == xtube_checkgroups($myrow['cid'], 'XTubeSubPerm')) {
                
$submitcats[$myrow['cid']] = $myrow['title'];
            }
        }

// Video time form
        
$timeform = new XoopsFormText(_MD_XTUBE_TIME'time'77$time);
        
$timeform->setDescription('<small>(h:mm:ss)</small>');
        
$sform->addElement($timeformFALSE);

// Video category form
        
ob_start();
        
$mytree->makeMySelBox('title''title'$cid0);
        
$sform->addElement(new XoopsFormLabel(_MD_XTUBE_CATEGORYCob_get_contents()));
        
ob_end_clean();

// Video description form
//        $editor = xtube_getWysiwygForm( _MD_XTUBE_DESCRIPTIONC, 'descriptionb', $descriptionb, 10, 50, '');
//        $sform -> addElement( $editor, true );

        
$optionsTrayNote = new XoopsFormElementTray(_MD_XTUBE_DESCRIPTIONC'<br />');
        if (
class_exists('XoopsFormEditor')) {
            
$options['name']   = 'descriptionb';
            
$options['value']  = $descriptionb;
            
$options['rows']   = 7;
            
$options['cols']   = 100;
            
$options['width']  = '100%';
            
$options['height'] = '200px';
            
$editor            = new XoopsFormEditor(''$xoopsModuleConfig['form_optionsuser'], $options$nohtml FALSE$onfailure 'textarea');
            
$optionsTrayNote->addElement($editor);
        } else {
            
$editor = new XoopsFormDhtmlTextArea('''descriptionb'$item->getVar('descriptionb''e'), '100%''100%');
            
$optionsTrayNote->addElement($editor);
        }

        
$sform->addElement($optionsTrayNoteFALSE);

        if (
$xoopsModuleConfig['usercantag'] == 1) {
// Insert tags if Tag-module is installed
            
if (xtube_tag_module_included()) {
                include_once 
XOOPS_ROOT_PATH '/modules/tag/include/formtag.php';
                
$text_tags = new XoopsFormTag('item_tag'70255$video_array['item_tag'], 0);
                
$sform->addElement($text_tags);
            }
        } else {
            
$sform->addElement(new XoopsFormHidden('item_tag'$video_array['item_tag']));
        }

        
$submitter2 = (is_object($xoopsUser) && !empty($xoopsUser)) ? $xoopsUser->getVar('uid') : 0;
        if (
$submitter2 0) {
            
$option_tray = new XoopsFormElementTray(_MD_XTUBE_OPTIONS'<br />');

            if (!
$approve) {
                
$notify_checkbox = new XoopsFormCheckBox('''notifypub');
                
$notify_checkbox->addOption(1_MD_XTUBE_NOTIFYAPPROVE);
                
$option_tray->addElement($notify_checkbox);
            } else {
                
$sform->addElement(new XoopsFormHidden('notifypub'0));
            }
        }

        if (
TRUE == xtube_checkgroups($cid'XTubeAppPerm') && $lid 0) {
            
$approve_checkbox = new XoopsFormCheckBox('''approve'$approve);
            
$approve_checkbox->addOption(1_MD_XTUBE_APPROVE);
            
$option_tray->addElement($approve_checkbox);
        } else {
            if (
TRUE == xtube_checkgroups($cid'XTubeAutoApp')) {
                
$sform->addElement(new XoopsFormHidden('approve'1));
            } else {
                
$sform->addElement(new XoopsFormHidden('approve'0));
            }
        }
        
$sform->addElement($option_tray);

        
$button_tray = new XoopsFormElementTray('''');
        
$button_tray->addElement(new XoopsFormButton('''submit'_SUBMIT'submit'));
        
$button_tray->addElement(new XoopsFormHidden('lid'$lid));

        
$sform->addElement($button_tray);
        
$sform->display();

        include 
XOOPS_ROOT_PATH '/footer.php';
    }
} else {
    
redirect_header('index.php'2_MD_XTUBE_NOPERMISSIONTOPOST);
    exit();
}
?>


Cela nous donne une description simple mais propre:
http://nsm08.casimages.com/img/2015/0 ... 071236251137512855382.png

Attention tout de même car j'ai ajouté des hébergeurs à mon xoopstube, vous devrez donc commen ter les lignes que vous n'utilisez pas:
sur cette partie du code
// Video source form
        
$vidsource_array  = array(
            
0   => _MD_XTUBE_YOUTUBE,
            
1   => _MD_XTUBE_METACAFE,
            
2   => _MD_XTUBE_IFILM,
            
4   => _MD_XTUBE_VIDDLER,
            
100 => _MD_XTUBE_GOOGLEVIDEO,
            
101 => _MD_XTUBE_MYSPAVETV,
            
102 => _MD_XTUBE_DAILYMOTION,
            
103 => _MD_XTUBE_BLIPTV,
            
104 => _MD_XTUBE_CLIPFISH,
            
105 => _MD_XTUBE_LIVELEAK,
            
106 => _MD_XTUBE_MAKTOOB,
            
107 => _MD_XTUBE_VEOH,
            
108 => _MD_XTUBE_VIMEO,
            
109 => _MD_XTUBE_RUTUBE,
            
110 => _MD_XTUBE_STAGEVU,
            
111 => _MD_XTUBE_NETU,
            
112 => _MD_XTUBE_MAILRU,
            
113 => _MD_XTUBE_EXASHARE,
            
114 => _MD_XTUBE_VK,
            
115 => _MD_XTUBE_VIDEOMEGA,
            
116 => _MD_XTUBE_SPEEDVIDEO,
            
117 => _MD_XTUBE_WAT,
            
118 => _MD_XTUBE_KIWI,
            
119 => _MD_XTUBE_VODLOCKER,
            
//120 => _MD_XTUBE_UPTOSTREAM,
            //121 => _MD_XTUBE_AXAVID,
        
);


Ca s'arrete à 108 d'origine, donc commenter(ou supprimer) les lignes comme j'ai faite pour les deux dernières.

Perso, je n'utilise pas les images allociné comme images dans les blocs, si vous souhaitez le faire, suffit juste de modifier cette ligne:
$picurl       $video_array['picurl'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['picurl']) : '';

et d'ajouter la variable $url_img comme suit:
$picurl       $video_array['picurl'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['picurl']) : ' .$url_img. ';


Télécharger le pack (api fourni)
uploader telle que sont les fichiers dans le pack.
hack xoopstube-allocine

voilou

Posté le : 07/01/2015 00:21
Transférer la contribution vers d'autres applications Transférer


Re: Utiliser l'api allociné dans xoopstube
Régulier
Inscrit: 10/09/2007 11:51
Messages: 476
Re

Actuellement , le var_dump m'affiche ceci:

array(1) { ["item_tag"]=> string(19"Animation Aventure " }


et c'est normal que le tableau soit vide car je fait un nouveau up, si je faisais une mise à jour du post, la le tableau serait plein.

c'est suivant le cas vu que le fichier sert normalement pour les 2 actions.

Posté le : 06/01/2015 19:21
Transférer la contribution vers d'autres applications Transférer


Re: Utiliser l'api allociné dans xoopstube
Régulier
Inscrit: 10/09/2007 11:51
Messages: 476
Re

c'est bien ça, il prend comme valeur la donnée de tableau vide.

J'ai réussi à afficher en faisant comme ça:
$item_tag     $video_array['item_tag'] ? $video_array['item_tag'] : $video_array['item_tag'] = $nom_genre;


Et puisque ce fichier ne sert pas aux mises à jour éventuel, (c'est tjrs submit.php qui s'en occupe), je pense pas que cela pose de problème.

Est ce que tu pourrait m'expliquer cette phrase de code, je comprend mal le fonctionnement (? = comparaison) mais plus clairement, c'est quoi:

$lid     $video_array['lid'] ? $video_array['lid'] : 0;

Posté le : 06/01/2015 17:56
Transférer la contribution vers d'autres applications Transférer


Re: Utiliser l'api allociné dans xoopstube
Régulier
Inscrit: 10/09/2007 11:51
Messages: 476
YOP

Je te reprend pour ce sujet, en fait ,je t'ai dit une bétise, la valeur avec var_dump s'affiche bien, mais pas la ou je pensais la trouver, je l'avais pas vu.

Regarde, elle apparait en haut à gauche du formulaire alors qu'elle devrait apparaitre dans le champ genre:

Open in new window


donc voila, je pige pas pourquoi, ma variable s'affiche pas dans mon champ mais c'est surement lié au fait que ce formulaire sert également à faire un update.

Doit y avoir un bug qui fait qu'au lieu de prendre ma valeur, il prend la valeur vide comme si on voulais faire un update.

mdr, je suis pas trés clair la.

Bref , je pige pas.

Posté le : 06/01/2015 17:24
Transférer la contribution vers d'autres applications Transférer


zonewebmaster.eu que du bon
Régulier
Inscrit: 10/09/2007 11:51
Messages: 476
Yop

haha ça me fait planer, je cherche des trucs sur le net et assez souvent, je me retrouve sur le site de montuy, franchement y'a pleins de truc intéressant et utile sur ce site, je vous le conseil.

Pour le coup, je cherchais comment récup les infos d'un flux rss et pan, pas loupé:

Script de récupération des données d'un Flux RSS ou Atom

Merci montuy

Posté le : 05/01/2015 22:16
Transférer la contribution vers d'autres applications Transférer


Re: Bug xoopstube - Catégorie
Régulier
Inscrit: 10/09/2007 11:51
Messages: 476
salut

pour le champ manquant, j'ai posté il y a peu le fichier modifié, faut chercher un peu avant de demander.

une recherche avec "description categorie xoopstube" t'aurait donnée la réponse.

ICI - ICI -ICI

Pour le bug des catégories alternative, personnellement, je l'ai pas celui la, ça ne m'est jamais arrivé et pourtant, je peut te dire que je le maltraite ce module.

ATTENTION avec les nouvelles versions de xoopstube, elles sont incompatible avec celle qu'on a sur xoopsfr, ils ont complétement modifié les fichiers et une mise à jour n'est pas envisageable, j'ai essayé, v'la la cata.
je le conseil vraiment pas, je préfère de loin ma version perso car il reste peu de bug à traiter.

Si tu veut absolument repartir sur une version plus récente, soit tu refait une install neuve, soit tu t'en passe.

Posté le : 05/01/2015 19:49
Transférer la contribution vers d'autres applications Transférer


Re: Régénérer les desciptions avec allociné
Régulier
Inscrit: 10/09/2007 11:51
Messages: 476
résolu et terminé merci

Posté le : 05/01/2015 19:33
Transférer la contribution vers d'autres applications Transférer


Re: Régénérer les desciptions avec allociné
Régulier
Inscrit: 10/09/2007 11:51
Messages: 476
re

les premières sont passé à 20 mais aprés 15h le dimanche, trop de monde, je ferais ça tranquile demain matin.

En tout cas merci montuy et slider ,j'y serais pas arrivé sans vous.

Thank's pour votre patience avec les noob.

Posté le : 04/01/2015 18:15
Transférer la contribution vers d'autres applications Transférer


Re: Régénérer les desciptions avec allociné
Régulier
Inscrit: 10/09/2007 11:51
Messages: 476
Bon c'est tout bon, ça fonctionne, sauf que l'api allociné à de très sérieux ralentissements, je suis obligé de faire 5 par 5 et ça passe pas tjrs, je me prend le time out php dans les dents très souvent et donc j'avance pas.

Code trouvé pour A Armes Egales 16220
mise à jour réussi pour A Armes Egales
Code trouvé pour R
.I.P.DBrigade Fantôme 184468
mise à jour réussi pour R
.I.P.DBrigade Fantôme
Code trouvé pour Avengers 
198488
Erreur n°5
Connection Timeout ExpiredThe timeout period elapsed during the post-login phaseThe connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connectionsThe duration spent while attempting to connect to this server was - [Pre-Logininitialization=612handshake=7506; [Logininitialization=0authentication=0; [Post-Logincomplete=989pour Avengers
Code trouvé pour Le Témoin du mal 
16502
mise à jour réussi pour Le Témoin du mal
Code trouvé pour Cliffhanger 
146602
mise à jour réussi pour Cliffhanger


Bon allez ,je laisse tomber, à cette heure c'est mission impossible, allociné, ton api c'est de la mrd, y'a pas de power.
Va falloir que je fasse ça super tôt le matin quand y'a moins de monde.

120/1500 y'a encore gros à faire.

J'ai suivi le conseil de montuy et j'ai fait ceci(LIMIT +OFFSET):

$sql$xoopsDB->query('SELECT lid, title FROM ' $xoopsDB->prefix('xoopstube_videos')
        . 
' WHERE published > 0 AND published <= ' time() . ' AND (expired = 0 OR expired > ' time()
        . 
') AND offline = 0 AND cid = 2
            LIMIT 5 OFFSET 128'
);


LOL même avec 2 ça passe pas:

Code trouvé pour Les Rivières pourpres 1325
mise à jour réussi pour Les Rivières pourpres
Erreur n°5
Connection Timeout ExpiredThe timeout period elapsed during the post-login phaseThe connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connectionsThe duration spent while attempting to connect to this server was - [Pre-Logininitialization=12handshake=1646; [Logininitialization=0authentication=0; [Post-Logincomplete=7999pour Signes
mise à jour réussi pour Signes

Posté le : 04/01/2015 15:38
Transférer la contribution vers d'autres applications Transférer



 Haut
« 1 ... 3 4 5 (6) 7 8 9 ... 48 »




Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

44 Personne(s) en ligne (36 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 44 | Plus ...