예제 #1
0
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
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 {
예제 #2
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_video = $_POST['cod_video'];
if ($_POST['confirm'] != 1) {
    xoops_confirm(array('cod_video' => $cod_video, 'confirm' => 1), 'delvideo.php', _MD_YOGURT_ASKCONFIRMVIDEODELETION, _MD_YOGURT_CONFIRMVIDEODELETION);
} else {
    /**
     * Creating the factory  and the criteria to delete the picture
     * The user must be the owner
     */
    $album_factory = new Xoopsyogurt_seutuboHandler($xoopsDB);
    $criteria_img = new Criteria('video_id', $cod_video);
    $uid = intval($xoopsUser->getVar('uid'));
    $criteria_uid = new Criteria('uid_owner', $uid);
    $criteria = new CriteriaCompo($criteria_img);
    $criteria->add($criteria_uid);
    /**
     * Try to delete  
     */
    if ($album_factory->deleteAll($criteria)) {
        redirect_header('seutubo.php?uid=' . $uid, 2, _MD_YOGURT_VIDEODELETED);
    } else {
        redirect_header('seutubo.php?uid=' . $uid, 2, _MD_YOGURT_NOCACHACA);
    }
}
include '../../footer.php';
예제 #3
0
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include_once '../../mainfile.php';
$xoopsOption['template_main'] = 'yogurt_index.html';
include_once '../../header.php';
include_once 'class/yogurt_seutubo.php';
/**
* 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);
예제 #4
0
    /**
     * Verifying who's the owner to allow changes
     */
    if ($uid == $video->getVar('uid_owner')) {
        if ($video_factory->insert($video)) {
            redirect_header('seutubo.php?uid=' . $uid, 2, _MD_YOGURT_DESC_EDITED);
        } else {
            redirect_header('index.php?uid=' . $uid, 2, _MD_YOGURT_NOCACHACA);
        }
    }
}
/**
* Creating the factory  and the criteria to edit the desc of the picture
* The user must be the owner
*/
$album_factory = new Xoopsyogurt_seutuboHandler($xoopsDB);
$criteria_video = new Criteria('video_id', $cod_img);
$criteria_uid = new Criteria('uid_owner', $uid);
$criteria = new CriteriaCompo($criteria_video);
$criteria->add($criteria_uid);
/**
* Lets fetch the info of the pictures to be able to render the form
* The user must be the owner
*/
if ($array_pict = $album_factory->getObjects($criteria)) {
    $caption = $array_pict[0]->getVar('video_desc');
    $url = $array_pict[0]->getVar('youtube_code');
}
$album_factory->renderFormEdit($caption, $cod_img, $url);
include '../../footer.php';
?>