Exemple #1
0
include_once '../../mainfile.php';
include_once '../../header.php';
include_once '../../class/criteria.php';
include_once 'class/yogurt_images.php';
if (!$GLOBALS['xoopsSecurity']->check()) {
    redirect_header($_SERVER['HTTP_REFERER'], 3, _MD_YOGURT_TOKENEXPIRED);
}
$cod_img = $_POST['cod_img'];
/**
* Creating the factory  loading the picture changing its caption
*/
$picture_factory = new Xoopsyogurt_imagesHandler($xoopsDB);
$picture = $picture_factory->create(false);
$picture->load($cod_img);
$picture->setVar('private', intval($_POST['private']));
/**
* Verifying who's the owner to allow changes
*/
$uid = intval($xoopsUser->getVar('uid'));
if ($uid == $picture->getVar('uid_owner')) {
    if ($picture_factory->insert($picture)) {
        if ($_POST['private'] == 1) {
            redirect_header('album.php', 2, _MD_YOGURT_PRIVATIZED);
        } else {
            redirect_header('album.php', 2, _MD_YOGURT_UNPRIVATIZED);
        }
    } else {
        redirect_header('album.php', 2, _MD_YOGURT_NOCACHACA);
    }
}
include '../../footer.php';