function unpublishSubalbums($album)
{
    global $gallery;
    $albums = $album->getAlbums();
    foreach ($albums as $albumname) {
        $subalbum = new Album($gallery, $albumname);
        $subalbum->setShow(false);
        $subalbum->save();
        unpublishSubalbums($subalbum);
    }
}
Example #2
0
 if (!empty($folder)) {
     if ($new) {
         $rightsalbum = new Album($gallery, dirname($folder));
     } else {
         $rightsalbum = new Album($gallery, $folder);
     }
     if (!$rightsalbum->isMyItem(UPLOAD_RIGHTS)) {
         if (!zp_apply_filter('admin_managed_albums_access', false, $return)) {
             header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin.php');
             exit;
         }
     }
     if ($new) {
         mkdir_recursive($targetPath, CHMOD_VALUE);
         $album = new Album($gallery, $folder);
         $album->setShow($_POST['http_publishalbum']);
         $album->setTitle(sanitize($_POST['http_albumtitle']));
         $album->setOwner($_zp_current_admin_obj->getUser());
         $album->save();
     }
     @chmod($targetPath, CHMOD_VALUE);
     $error = zp_apply_filter('check_upload_quota', UPLOAD_ERR_OK, $tempFile);
     if (!$error) {
         if (is_valid_image($name) || is_valid_other_type($name)) {
             $seoname = seoFriendly($name);
             if (strrpos($seoname, '.') === 0) {
                 $seoname = sha1($name) . $seoname;
             }
             // soe stripped out all the name.
             $targetFile = $targetPath . '/' . internalToFilesystem($seoname);
             if (file_exists($targetFile)) {
         }
     }
 }
 $newAlbum = $_POST['existingfolder'] == 'false' || isset($_POST['newalbum']);
 // Make sure the folder exists. If not, create it.
 if (isset($_POST['processed']) && !empty($_POST['folder']) && ($newAlbum || !$files_empty)) {
     $folder = sanitize_path($_POST['folder']);
     $uploaddir = $gallery->albumdir . UTF8ToFilesystem($folder);
     if (!is_dir($uploaddir)) {
         mkdir($uploaddir, CHMOD_VALUE);
     }
     @chmod($uploaddir, CHMOD_VALUE);
     $album = new Album($gallery, $folder);
     if ($album->exists) {
         if (!isset($_POST['publishalbum'])) {
             $album->setShow(false);
         }
         $title = sanitize($_POST['albumtitle'], 2);
         if (!empty($title) && $newAlbum) {
             $album->setTitle($title);
         }
         $album->save();
     } else {
         $AlbumDirName = str_replace(SERVERPATH, '', $gallery->albumdir);
         zp_error(gettext("The album couldn't be created in the 'albums' folder. This is usually a permissions problem. Try setting the permissions on the albums and cache folders to be world-writable using a shell:") . " <code>chmod 777 " . $AlbumDirName . CACHEFOLDER . "</code>, " . gettext("or use your FTP program to give everyone write permissions to those folders."));
     }
     $error = false;
     foreach ($_FILES['files']['error'] as $key => $error) {
         if ($_FILES['files']['name'][$key] == "") {
             continue;
         }
Example #4
0
 if (!empty($folder)) {
     if ($new) {
         $rightsalbum = new Album($gallery, dirname($folder));
     } else {
         $rightsalbum = new Album($gallery, $folder);
     }
     if (!$rightsalbum->isMyItem(UPLOAD_RIGHTS)) {
         if (!zp_apply_filter('admin_managed_albums_access', false, $return)) {
             header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin.php');
             exit;
         }
     }
     if ($new) {
         mkdir_recursive($targetPath, CHMOD_VALUE);
         $album = new Album($gallery, $folder);
         $album->setShow($albumparmas[0] != 'false');
         $album->setTitle($albumparmas[2]);
         $album->setOwner($_zp_current_admin_obj->getUser());
         $album->save();
     }
     @chmod($targetPath, CHMOD_VALUE);
     $error = zp_apply_filter('check_upload_quota', UPLOAD_ERR_OK, $tempFile);
     if (!$error) {
         if (is_valid_image($name) || is_valid_other_type($name)) {
             $seoname = seoFriendly($name);
             if (strrpos($seoname, '.') === 0) {
                 $seoname = sha1($name) . $seoname;
             }
             // soe stripped out all the name.
             $targetFile = $targetPath . '/' . internalToFilesystem($seoname);
             if (file_exists($targetFile)) {
Example #5
0
             $return = '';
         } else {
             $return = '&album=' . $return . '&tab=subalbuminfo';
         }
     }
     header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin-edit.php?page=edit' . $return);
     exit;
     break;
     /** Publish album  ************************************************************/
     /******************************************************************************/
 /** Publish album  ************************************************************/
 /******************************************************************************/
 case "publish":
     XSRFdefender('albumedit');
     $album = new Album($gallery, $folder);
     $album->setShow($_GET['value']);
     $album->save();
     $return = pathurlencode(dirname($folder));
     if (!empty($return)) {
         if ($return == '.' || $return == '/') {
             $return = '';
         } else {
             $return = '&album=' . $return . '&tab=subalbuminfo';
         }
     }
     header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin-edit.php?page=edit' . $return);
     exit;
     break;
     /** Reset hitcounters ***********************************************************/
     /********************************************************************************/
 /** Reset hitcounters ***********************************************************/
/**
 * Processes the check box bulk actions for albums
 *
 */
function processAlbumBulkActions()
{
    global $gallery;
    $action = sanitize($_POST['checkallaction']);
    $ids = $_POST['ids'];
    $total = count($ids);
    $message = NULL;
    if ($action != 'noaction') {
        if ($total > 0) {
            if ($action == 'addtags' || $action == 'alltags') {
                foreach ($_POST as $key => $value) {
                    $key = postIndexDecode($key);
                    if (substr($key, 0, 10) == 'mass_tags_') {
                        if ($value) {
                            $tags[] = substr($key, 10);
                        }
                    }
                }
                $tags = sanitize($tags, 3);
            }
            $n = 0;
            foreach ($ids as $albumname) {
                $n++;
                $albumobj = new Album($gallery, $albumname);
                switch ($action) {
                    case 'deleteall':
                        $albumobj->remove();
                        break;
                    case 'showall':
                        $albumobj->setShow(1);
                        break;
                    case 'hideall':
                        $albumobj->setShow(0);
                        break;
                    case 'commentson':
                        $albumobj->setCommentsAllowed(1);
                        break;
                    case 'commentsoff':
                        $albumobj->setCommentsAllowed(0);
                        break;
                    case 'resethitcounter':
                        $albumobj->set('hitcounter', 0);
                        break;
                    case 'addtags':
                        $mytags = array_unique(array_merge($tags, $albumobj->getTags()));
                        $albumobj->setTags($mytags);
                        break;
                    case 'cleartags':
                        $albumobj->setTags(array());
                        break;
                    case 'alltags':
                        $images = $albumobj->getImages();
                        foreach ($images as $imagename) {
                            $imageobj = newImage($albumobj, $imagename);
                            $mytags = array_unique(array_merge($tags, $imageobj->getTags()));
                            $imageobj->setTags($mytags);
                            $imageobj->save();
                        }
                        break;
                    case 'clearalltags':
                        $images = $albumobj->getImages();
                        foreach ($images as $imagename) {
                            $imageobj = newImage($albumobj, $imagename);
                            $imageobj->setTags(array());
                            $imageobj->save();
                        }
                        break;
                }
                $albumobj->save();
            }
        }
        return $action;
    }
}