Exemple #1
0
function forceAlbum($success)
{
    // we presume that the site only serves the one album.
    $gallery = new Gallery();
    $albums = $gallery->getAlbums();
    $_GET['album'] = array_shift($albums);
    return $success;
}
/**
 * Prints all albums of the Zenphoto gallery as a partial drop down menu (<option></option> parts).
 *
 * @return string
 */
function printFullAlbumsList()
{
    global $_zp_gallery;
    if (is_null($_zp_gallery)) {
        $_zp_gallery = new Gallery();
    }
    $albumlist = $_zp_gallery->getAlbums();
    foreach ($albumlist as $album) {
        $albumobj = new Album($_zp_gallery, $album);
        if ($albumobj->isMyItem(LIST_RIGHTS)) {
            echo "<option value='" . pathurlencode($albumobj->name) . "'>" . html_encode($albumobj->getTitle()) . unpublishedZenphotoItemCheck($albumobj) . " (" . $albumobj->getNumImages() . ")</option>";
            if (!$albumobj->isDynamic()) {
                printSubLevelAlbums($albumobj);
            }
        }
    }
}
    gettext("database connected");
    ?>
</h3>
	<br />
	<?php 
    $albpublish = getOption('album_publish');
    $imgpublish = getOption('image_publish');
    if (isset($_POST['publish_date'])) {
        $requestdate = dateTimeConvert(sanitize($_POST['publish_date']));
    } else {
        $requestdate = date('Y-m-d H:i:s');
    }
    $albumidlist = '';
    $albumids = '';
    if (zp_loggedin(ADMIN_RIGHTS)) {
        $albumlist = $gallery->getAlbums();
    } else {
        $albumlist = getManagedAlbumList();
        $albumIDs = array();
        foreach ($albumlist as $albumname) {
            $subalbums = getAllSubAlbumIDs($albumname);
            foreach ($subalbums as $ID) {
                $albumIDs[] = $ID['id'];
            }
        }
        $i = 0;
        foreach ($albumIDs as $ID) {
            if ($i > 0) {
                $albumidlist .= ' OR ';
                $albumids .= ' OR ';
            }
            }
        }
    }
}
printAdminHeader(gettext('utilities'), gettext('SEO cleaner'));
if (isset($_GET['todo'])) {
    $count = sanitize_numeric($_GET['imagecount']);
    $albumcount = sanitize_numeric($_GET['albumcount']);
    $albums = array();
    foreach (explode(',', sanitize(sanitize($_GET['todo']))) as $album) {
        $albums[] = sanitize($album);
    }
} else {
    $count = 0;
    $albumcount = 0;
    $albums = $gallery->getAlbums();
}
?>
<script type="text/javascript">
<!--
	var albumcount = 0;
	var imagecount = 0;
	var albumspending = [<?php 
$c = 0;
foreach ($albums as $key => $album) {
    if (hasDynamicAlbumSuffix($album)) {
        unset($albums[$key]);
    } else {
        if ($c) {
            echo ',';
        }
/**
 * Adds albums to the menu set. Returns the next sort order base
 * @param string $menuset current menu set
 * @param string $base starting "sort order"
 * @return int
 */
function addalbumsToDatabase($menuset, $base = NULL)
{
    if (is_null($base)) {
        $sql = "SELECT COUNT(id) FROM " . prefix('menu') . ' WHERE menuset=' . db_quote($menuset);
        $result = query($sql);
        $albumbase = db_result($result, 0);
        $sortbase = '';
    } else {
        $albumbase = array_pop($base);
        $sortbase = '';
        for ($i = 0; $i < count($base); $i++) {
            $sortbase .= sprintf('%03u', $base[$i]) . '-';
        }
    }
    $result = $albumbase;
    $gallery = new Gallery();
    $albums = $gallery->getAlbums();
    foreach ($albums as $key => $link) {
        addSubalbumMenus($menuset, $gallery, 0, $link, $sortbase . sprintf('%03u', $result = $key + $albumbase));
    }
    return $result;
}
zp_apply_filter('admin_note', 'users', $subtab);
switch ($subtab) {
    case 'groups':
        $adminlist = $adminordered;
        $users = array();
        $groups = array();
        foreach ($adminlist as $user) {
            if ($user['valid']) {
                $users[] = $user['user'];
            } else {
                $groups[] = $user;
            }
        }
        $gallery = new Gallery();
        $albumlist = array();
        foreach ($gallery->getAlbums() as $folder) {
            if (hasDynamicAlbumSuffix($folder)) {
                $name = substr($folder, 0, -4);
                // Strip the .'.alb' suffix
            } else {
                $name = $folder;
            }
            $albumlist[$name] = $folder;
        }
        ?>
						<p>
							<?php 
        echo gettext("Set group rights and select one or more albums for the users in the group to manage. Users with <em>User admin</em> or <em>Manage all albums</em> rights can manage all albums. All others may manage only those that are selected.");
        ?>
						</p>
						<form action="?action=savegroups&amp;tab=groups" method="post" autocomplete="off" onsubmit="return checkSubmit()" >
                echo "\n</div>";
            }
        }
        $albumdir = "";
        if (isset($_GET['album'])) {
            $folder = sanitize_path($_GET['album']);
            $album = new Album($gallery, $folder);
            if ($album->isMyItem(ALBUM_RIGHTS)) {
                $albums = $album->getAlbums();
                $pieces = explode('/', $folder);
                $albumdir = "&album=" . pathurlencode($folder) . '&tab=subalbuminfo';
            } else {
                $albums = array();
            }
        } else {
            $albumsprime = $gallery->getAlbums();
            $albums = array();
            foreach ($albumsprime as $folder) {
                // check for rights
                $album = new Album($gallery, $folder);
                if ($album->isMyItem(ALBUM_RIGHTS)) {
                    $albums[] = $folder;
                }
            }
        }
        ?>
<h1><?php 
        echo gettext("Edit All Albums in");
        ?>
 <?php 
        if (!isset($_GET['album'])) {
Exemple #8
0
echo "\n</head>";
echo "\n<body>";
printLogoAndLinks();
echo "\n" . '<div id="main">';
printTabs();
echo "\n" . '<div id="content">';
$galleryTheme = $_zp_gallery->getCurrentTheme();
$themelist = array();
if (zp_loggedin(ADMIN_RIGHTS)) {
    $gallery_title = $_zp_gallery->getTitle();
    if ($gallery_title != gettext("Gallery")) {
        $gallery_title .= ' (' . gettext("Gallery") . ')';
    }
    $themelist[$gallery_title] = '';
}
$albums = $_zp_gallery->getAlbums(0);
foreach ($albums as $alb) {
    $album = newAlbum($alb);
    if ($album->isMyItem(THEMES_RIGHTS)) {
        $key = $album->getTitle();
        if ($key != $alb) {
            $key .= " ({$alb})";
        }
        $themelist[$key] = $alb;
    }
}
if (!empty($_REQUEST['themealbum'])) {
    $alb = sanitize_path($_REQUEST['themealbum']);
    $album = newAlbum($alb);
    $albumtitle = $album->getTitle();
    $themename = $album->getAlbumTheme();
function genAlbumUploadList(&$list, $curAlbum = NULL)
{
    $gallery = new Gallery();
    $albums = array();
    if (is_null($curAlbum)) {
        $albumsprime = $gallery->getAlbums(0);
        foreach ($albumsprime as $album) {
            // check for rights
            $albumobj = new Album($gallery, $album);
            if ($albumobj->isMyItem(UPLOAD_RIGHTS)) {
                $albums[] = $album;
            }
        }
    } else {
        $albums = $curAlbum->getAlbums(0);
    }
    if (is_array($albums)) {
        foreach ($albums as $folder) {
            $album = new Album($gallery, $folder);
            if (!$album->isDynamic()) {
                $list[$album->getFolder()] = $album->getTitle();
                genAlbumUploadList($list, $album);
                /* generate for subalbums */
            }
        }
    }
}