Ejemplo n.º 1
0
include_once '../../mainfile.php';
include_once '../../header.php';
include_once '../../class/criteria.php';
include_once 'class/yogurt_seutubo.php';
if (!$GLOBALS['xoopsSecurity']->check()) {
    redirect_header($_SERVER['HTTP_REFERER'], 3, _MD_YOGURT_TOKENEXPIRED);
}
$cod_img = intval($_POST['video_id']);
/**
* Creating the factory  loading the video changing its caption
*/
$video_factory = new Xoopsyogurt_seutuboHandler($xoopsDB);
$video = $video_factory->create(false);
$video->load($cod_img);
$video->setVar('main_video', 1);
/**
* Verifying who's the owner to allow changes
*/
$uid = intval($xoopsUser->getVar('uid'));
if ($uid == $video->getVar('uid_owner')) {
    if ($video_factory->unsetAllMainsbyID($uid)) {
        if ($video_factory->insert($video)) {
            redirect_header('seutubo.php', 2, _MD_YOGURT_SETMAINVIDEO);
        } else {
            redirect_header('seutubo.php', 2, _MD_YOGURT_NOCACHACA);
        }
    } else {
        echo "nao deu certo";
    }
}
include '../../footer.php';
Ejemplo n.º 2
0
/**
* Factory of pictures created  
*/
$album_factory = new Xoopsyogurt_seutuboHandler($xoopsDB);
$url = $_POST['codigo'];
if (!$GLOBALS['xoopsSecurity']->check()) {
    redirect_header($_SERVER['HTTP_REFERER'], 3, _MD_YOGURT_TOKENEXPIRED);
}
/**
* Try to upload picture resize it insert in database and then redirect to index
*/
$newvideo = $album_factory->create(true);
$newvideo->setVar('uid_owner', intval($xoopsUser->getVar('uid')));
$newvideo->setVar('video_desc', trim(htmlspecialchars($_POST['caption'])));
if (strlen($url) == 11) {
    $code = $url;
} else {
    $position_of_code = strpos($url, 'v=');
    $code = substr($url, $position_of_code + 2, 11);
}
$newvideo->setVar('youtube_code', $code);
if ($album_factory->insert($newvideo)) {
    $extra_tags['X_OWNER_NAME'] = $xoopsUser->getVar('uname');
    $extra_tags['X_OWNER_UID'] = intval($xoopsUser->getVar('uid'));
    $notification_handler =& xoops_gethandler('notification');
    $notification_handler->triggerEvent('video', intval($xoopsUser->getVar('uid')), 'new_video', $extra_tags);
    redirect_header(XOOPS_URL . '/modules/yogurt/seutubo.php?uid=' . intval($xoopsUser->getVar('uid')), 2, _MD_YOGURT_VIDEOSAVED);
} else {
    redirect_header(XOOPS_URL . '/modules/yogurt/seutubo.php?uid=' . intval($xoopsUser->getVar('uid')), 2, _MD_YOGURT_NOCACHACA);
}
include '../../footer.php';