Exemple #1
0
}
$cod_img = $_POST['cod_img'];
if (!isset($_POST['confirm']) || $_POST['confirm'] != 1) {
    xoops_confirm(array('cod_img' => $cod_img, 'confirm' => 1), 'delpicture.php', _MD_YOGURT_ASKCONFIRMDELETION, _MD_YOGURT_CONFIRMDELETION);
} else {
    /**
     * Creating the factory  and the criteria to delete the picture
     * The user must be the owner
     */
    $album_factory = new Xoopsyogurt_imagesHandler($xoopsDB);
    $criteria_img = new Criteria('cod_img', $cod_img);
    $uid = intval($xoopsUser->getVar('uid'));
    $criteria_uid = new Criteria('uid_owner', $uid);
    $criteria = new CriteriaCompo($criteria_img);
    $criteria->add($criteria_uid);
    $objects_array = $album_factory->getObjects($criteria);
    $image_name = $objects_array[0]->getVar('url');
    $avatar_image = $xoopsUser->getVar('user_avatar');
    /**
     * Try to delete  
     */
    if ($album_factory->deleteAll($criteria)) {
        if ($xoopsModuleConfig['physical_delete'] == 1) {
            //unlink($xoopsModuleConfig['path_upload']."\/".$image_name);
            unlink(XOOPS_ROOT_PATH . '/uploads' . '/' . $image_name);
            unlink(XOOPS_ROOT_PATH . '/uploads' . '/resized_' . $image_name);
            /**
             * Delete the thumb (avatar now has another name)
             */
            //if ($avatar_image!=$image_name){
            unlink(XOOPS_ROOT_PATH . '/uploads' . '/thumb_' . $image_name);
Exemple #2
0
     * Verifying who's the owner to allow changes
     */
    if ($uid == $picture->getVar('uid_owner')) {
        if ($picture_factory->insert($picture)) {
            redirect_header('album.php', 2, _MD_YOGURT_DESC_EDITED);
        } else {
            redirect_header('album.php', 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_imagesHandler($xoopsDB);
$criteria_img = new Criteria('cod_img', $cod_img);
$criteria_uid = new Criteria('uid_owner', $uid);
$criteria = new CriteriaCompo($criteria_img);
$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('title');
    $url = $array_pict[0]->getVar('url');
}
//$url = $xoopsModuleConfig['link_path_upload']."/thumb_".$url;
$url = XOOPS_URL . '/uploads/thumb_' . $url;
$album_factory->renderFormEdit($caption, $cod_img, $url);
include '../../footer.php';