Пример #1
0
								</label>
								<?php 
    XSRFToken('publishContent');
    ?>
								<input type="hidden" name="publish" value="albums" />
								<ul class="schedulealbumchecklist">
									<?php 
    foreach ($publish_albums_list as $analbum => $albumid) {
        $album = newAlbum($analbum);
        $thumbimage = $album->getAlbumThumbImage();
        $thumb = getAdminThumb($thumbimage, 'large');
        ?>
										<li>
											<label>
												<input type="checkbox" class="checkAuto" name="<?php 
        echo postIndexEncode($analbum);
        ?>
" value="<?php 
        echo $albumid;
        ?>
" class="albumcheck" />
												<img src="<?php 
        echo html_encode(pathurlencode($thumb));
        ?>
" width="60" height="60" alt="" title="album thumb" />
												<?php 
        echo $album->name;
        ?>
											</label>
											<a href="<?php 
        echo $album->getLink();
Пример #2
0
            }
        }
        if ($user['valid'] == 2) {
            $hits = 0;
            foreach ($adminordered as $tuser) {
                if ($tuser['user'] == $user['user']) {
                    $hits++;
                }
            }
            if ($hits > 1) {
                $checked_delete = ' checked="chedked"';
                $checked_disable = ' disabled="disabled"';
                $expires_display = ' <span style="color:red">' . gettext('User id has been preempted') . '</span>';
            }
        }
        $id = postIndexEncode($user['id']);
        $r1 = '<img src="../../images/fail.png" title="' . gettext('delete') . '" /><input type="radio" name="r_' . $id . '" value="delete"' . $checked_delete . ' />&nbsp;';
        if ($user['valid'] == 2) {
            $r2 = '<img src="../../images/lock_open.png" title="' . gettext('enable') . '" /><input type="radio" name="r_' . $id . '" value="enable"' . $checked_disable . ' />&nbsp;';
        } else {
            $r2 = '<img src="../../images/lock_2.png" title="' . gettext('disable') . '" /><input type="radio" name="r_' . $id . '" value="disable"' . $checked_disable . ' />&nbsp;';
        }
        $r3 = '<img src="../../images/pass.png" title="' . gettext('renew') . '" /><input type="radio" name="r_' . $id . '" value="renew"' . $checked_renew . $checked_disable . ' />&nbsp;';
        if (!$user['email']) {
            $checked_disable = ' disabled="disabled"';
        }
        $r4 = '<img src="../../images/envelope.png" title="' . gettext('Email renewal') . '" /><input type="radio" name="r_' . $id . '" value="revalidate"' . $checked_disable . ' />&nbsp;';
        ?>
								<li>
									<?php 
        printf(gettext('%1$s <strong>%2$s</strong> (%3$s; last logon:%4$s)'), $r1 . $r2 . $r3 . $r4, html_encode($user['user']), $expires_display, $loggedin);
Пример #3
0
/**
 * Creates an unordered checklist of the tags
 *
 * @param object $that Object for which to get the tags
 * @param string $postit prefix to prepend for posting
 * @param bool $showCounts set to true to get tag count displayed
 * @param string $tagsort set true to sort alphabetically
 * @param bool $addnew true enables adding tags, ==2 for "additive" tags
 * @param bool $resizeable set true to allow the box to be resized
 * @param string $class class of the selections
 */
function tagSelector($that, $postit, $showCounts = false, $tagsort = 'alpha', $addnew = true, $resizeable = false, $class = 'checkTagsAuto')
{
    global $_zp_admin_ordered_taglist, $_zp_admin_LC_taglist;
    if ((int) $addnew <= 1 && is_null($_zp_admin_ordered_taglist)) {
        switch ($tagsort) {
            case 'language':
                $order = '`language` DESC,`name`';
                break;
            case 'recent':
                $order = '`id` DESC';
                break;
            default:
                $order = '`name`';
                break;
        }
        $languages = $counts = array();
        $sql = "SELECT DISTINCT tags.name, tags.language, tags.id, (SELECT COUNT(*) FROM " . prefix('obj_to_tag') . " as object WHERE object.tagid = tags.id) AS count FROM " . prefix('tags') . " as tags ORDER BY {$order}";
        $tagresult = query($sql);
        if ($tagresult) {
            while ($tag = db_fetch_assoc($tagresult)) {
                $counts[$tag['name']] = $tag['count'];
                $languages[$tag['name']] = $tag['language'];
            }
            db_free_result($tagresult);
        }
        if ($tagsort == 'mostused') {
            arsort($counts, SORT_NUMERIC);
        }
        $_zp_admin_LC_taglist = $them = array();
        foreach ($counts as $tag => $count) {
            $them[mb_strtolower($tag)] = $tag;
            $_zp_admin_LC_taglist[$tag] = $tag;
        }
        $flags = array('' => WEBPATH . '/' . ZENFOLDER . '/images/placeholder.png');
        foreach (generateLanguageList('all') as $dirname) {
            $flags[$dirname] = getLanguageFlag($dirname);
        }
        $_zp_admin_ordered_taglist = array($them, $counts, $languages, $flags);
    } else {
        list($them, $counts, $languages, $flags) = $_zp_admin_ordered_taglist;
        if ((int) $addnew == 2) {
            $them = $counts = array();
        }
    }
    if (is_null($that)) {
        $tags = array();
    } else {
        $tags = $that->getTags(false);
    }
    if (count($tags) > 0) {
        $them = array_diff_key($them, $tags);
    }
    $total = count($tags) + count($them);
    if ($resizeable) {
        if ($total > 0) {
            $tagclass = 'resizeable_tagchecklist';
        } else {
            $tagclass = 'resizeable_empty_tagchecklist';
        }
        if (is_bool($resizeable)) {
            $tagclass .= ' resizeable_tagchecklist_fixed_width';
        }
        ?>
			<script>
				$(function () {
					$("#resizable_<?php 
        echo $postit;
        ?>
").resizable({
						minHeight: 120,
						resize: function (event, ui) {
							$(this).css("width", '');
							$('#list_<?php 
        echo $postit;
        ?>
').height($('#resizable_<?php 
        echo $postit;
        ?>
').height());
						}
					})
				});</script>
			<?php 
    } else {
        $tagclass = 'tagchecklist';
    }
    if ($addnew) {
        ?>
			<span class="new_tag displayinline" >
				<a onclick="addNewTag('<?php 
        echo $postit;
        ?>
');" title="<?php 
        echo gettext('add tag');
        ?>
">
					<img src="<?php 
        echo WEBPATH . '/' . ZENFOLDER;
        ?>
/images/add.png" title="<?php 
        echo gettext('add tag');
        ?>
"/>
				</a>
				<span class="tagSuggestContainer">
					<input class="tagsuggest <?php 
        echo $class;
        ?>
 " type="text" value="" name="newtag_<?php 
        echo $postit;
        ?>
" id="newtag_<?php 
        echo $postit;
        ?>
" />
				</span>
			</span>
			<?php 
        if ((int) $addnew == 2) {
            ?>
				<input type="hidden" value="1" name="additive_<?php 
            echo $postit;
            ?>
" id="additive_<?php 
            echo $postit;
            ?>
" />
				<?php 
        }
    }
    ?>
		<div id="resizable_<?php 
    echo $postit;
    ?>
" class="tag_div">
			<ul id="list_<?php 
    echo $postit;
    ?>
" class="<?php 
    echo $tagclass;
    ?>
">
				<?php 
    if (count($tags) > 0) {
        foreach ($tags as $tag => $item) {
            $listitem = $postit . postIndexEncode($item);
            ?>
						<li id="<?php 
            echo $tag;
            ?>
_element">
							<label class="displayinline">
								<input id="<?php 
            echo $listitem;
            ?>
" class="<?php 
            echo $class;
            ?>
" name="<?php 
            echo 'tag_list_' . $postit . '[]';
            ?>
" type="checkbox" checked="checked" value="<?php 
            echo html_encode($item);
            ?>
" />
								<img src="<?php 
            echo $flags[$languages[$item]];
            ?>
" height="10" width="16" />
								<?php 
            if ($showCounts) {
                echo html_encode($item) . ' [' . $counts[$item] . ']';
            } else {
                echo html_encode($item);
            }
            ?>
							</label>
						</li>
						<?php 
        }
        ?>
					<li><hr /></li>
					<?php 
    }
    foreach ($them as $tagLC => $item) {
        $listitem = $postit . postIndexEncode($item);
        ?>
					<li id="<?php 
        echo $listitem;
        ?>
_element">
						<label class="displayinline">
							<input id="<?php 
        echo $listitem;
        ?>
" class="<?php 
        echo $class;
        ?>
" name="<?php 
        echo 'tag_list_' . $postit . '[]';
        ?>
" type="checkbox" value="<?php 
        echo html_encode($item);
        ?>
" />
							<img src="<?php 
        echo $flags[$languages[$item]];
        ?>
" height="10" width="16" />
							<?php 
        if ($showCounts) {
            echo html_encode($item) . ' [' . $counts[$item] . ']';
        } else {
            echo html_encode($item);
        }
        ?>
						</label>
					</li>
					<?php 
    }
    ?>
			</ul>
		</div>
		<?php 
}
Пример #4
0
						<h2 class="h2_bordered_edit"><?php 
echo gettext("Rename tags");
?>
</h2>
						<form class="dirtylistening" onReset="setClean('form_tagrename');" name="tag_rename" id="form_tagrename" action="?rename=true&amp;tagsort=<?php 
echo html_encode($tagsort);
?>
" method="post" autocomplete="off" >
							<?php 
XSRFToken('tag_rename');
?>
							<div class="box-tags-unpadded">
								<ul class="tagrenamelist">
									<?php 
foreach ($list as $item) {
    $listitem = 'R_' . postIndexEncode($item);
    ?>
										<li>
											<label>
												<img src="<?php 
    echo $flags[$languages[$item]];
    ?>
" height="10" width="16" />
												<?php 
    echo $item;
    ?>
												<br />
												<input id="<?php 
    echo $listitem;
    ?>
" name="<?php 
Пример #5
0
						</form>
						<script language="javascript" type="text/javascript">
							//<!-- <![CDATA[
							function checkSubmit() {
								newgroupid = <?php 
        echo $id - 1;
        ?>
;
								var c = 0;
								<?php 
        foreach ($users as $name) {
            ?>
									c = 0;
								  for (i=0;i<=newgroupid;i++) {
									  if ($('#user_'+i+'-<?php 
            echo postIndexEncode($name);
            ?>
').attr('checked')) c++;
									}
									if (c>1) {
										alert('<?php 
            echo sprintf(gettext('User %s is assigned to more than one group.'), $name);
            ?>
');
										return false;
									}
									<?php 
        }
        ?>
								newgroup = $('#group-'+newgroupid).val().replace(/^\s+|\s+$/g,"");
								if (newgroup=='') return true;
Пример #6
0
/**
 * Returns table row(s) for edit of an admin user's custom data
 *
 * @param string $html always empty
 * @param $userobj Admin user object
 * @param string $i prefix for the admin
 * @param string $background background color for the admin row
 * @param bool $current true if this admin row is the logged in admin
 * @return string
 */
function user_groups_edit_admin($html, $userobj, $i, $background, $current)
{
    global $gallery, $_zp_authority, $_zp_zenpage;
    $group = $userobj->getGroup();
    $admins = $_zp_authority->getAdministrators('all');
    $ordered = array();
    $groups = array();
    $hisgroup = NULL;
    $adminordered = array();
    foreach ($admins as $key => $admin) {
        $ordered[$key] = $admin['user'];
        if ($group == $admin['user']) {
            $hisgroup = $admin;
        }
    }
    asort($ordered);
    foreach ($ordered as $key => $user) {
        $adminordered[] = $admins[$key];
        if (!$admins[$key]['valid']) {
            $groups[] = $admins[$key];
        }
    }
    if (empty($groups)) {
        return '';
    }
    // no groups setup yet
    if (zp_loggedin(ADMIN_RIGHTS)) {
        $albumlist = array();
        $allalb = array();
        foreach ($gallery->getAlbums() as $folder) {
            if (hasDynamicAlbumSuffix($folder)) {
                $name = substr($folder, 0, -4);
                // Strip the .'.alb' suffix
            } else {
                $name = $folder;
            }
            $albumlist[$name] = $folder;
            $allalb[] = "'#managed_albums_" . $i . '_' . postIndexEncode($folder) . "'";
        }
        if (getOption('zp_plugin_zenpage')) {
            $pagelist = array();
            $allpag = array();
            $pages = $_zp_zenpage->getPages(false);
            foreach ($pages as $page) {
                if (!$page['parentid']) {
                    $pagelist[get_language_string($page['title'])] = $page['titlelink'];
                    $allpag[] = "'#managed_pages_" . $i . '_' . postIndexEncode($page['titlelink']) . "'";
                }
            }
            $newslist = array();
            $allnew = array();
            $categories = $_zp_zenpage->getAllCategories(false);
            foreach ($categories as $category) {
                $newslist[get_language_string($category['titlelink'])] = $category['title'];
                $allnew[] = "'#managed_news_" . $i . '_' . postIndexEncode($category['titlelink']) . "'";
            }
        }
        $rights = array();
        foreach ($_zp_authority->getRights() as $rightselement => $right) {
            if ($right['display']) {
                $rights[] = "'#" . $rightselement . '-' . $i . "'";
            }
        }
        $grouppart = '
			<script type="text/javascript">
				// <!-- <![CDATA[
				function groupchange' . $i . '(obj) {
					var disable = obj.value != \'\';
					var albdisable = false;
					var checkedalbums = [];
					var checked = 0;
					var uncheckedalbums = [];
					var unchecked = 0;
					var allalbums = [' . implode(',', $allalb) . '];
					var allalbumsc = ' . count($allalb) . ';';
        if (getOption('zp_plugin_zenpage')) {
            $grouppart .= '
						var allpages = [' . implode(',', $allpag) . '];
						var allpagesc = ' . count($allpag) . ';
						var allnews = [' . implode(',', $allnew) . '];
						var allnewsc = ' . count($allnew) . ';';
        }
        $grouppart .= '
					var rights = [' . implode(',', $rights) . '];
					var rightsc = ' . count($rights) . ';
					for (i=0;i<rightsc;i++) {
						$(rights[i]).attr(\'disabled\',disable);
					}
					for (i=0;i<allalbumsc;i++) {
						$(allalbums[i]).attr(\'disabled\',disable);
					}';
        if (getOption('zp_plugin_zenpage')) {
            $grouppart .= '
					for (i=0;i<allpagesc;i++) {
						$(allpages[i]).attr(\'disabled\',disable);
					}
					for (i=0;i<allnewsc;i++) {
						$(allnews[i]).attr(\'disabled\',disable);
					}';
        }
        $grouppart .= '
					$(\'#hint' . $i . '\').html(obj.options[obj.selectedIndex].title);
					if (disable) {
						switch (obj.value) {';
        foreach ($groups as $user) {
            $grouppart .= '
							case \'' . $user['user'] . '\':
								target = ' . $user['rights'] . ';';
            if (getOption('zp_plugin_zenpage')) {
                $codelist = array('album', 'pages', 'news');
            } else {
                $codelist = array('album');
            }
            foreach ($codelist as $mo) {
                $cv = populateManagedObjectsList($mo, $user['id']);
                switch ($mo) {
                    case 'album':
                        $xv = array_diff($albumlist, $cv);
                        break;
                    case 'pages':
                        $xv = array_diff($pagelist, $cv);
                        break;
                    case 'news':
                        $xv = array_diff($newslist, $cv);
                        break;
                }
                $cvo = array();
                foreach ($cv as $moid) {
                    $cvo[] = "'#managed_" . $mo . "_" . $i . '_' . postIndexEncode($moid) . "'";
                }
                $xvo = array();
                foreach ($xv as $moid) {
                    $xvo[] = "'#managed_" . $mo . "_" . $i . '_' . postIndexEncode($moid) . "'";
                }
                $grouppart .= '
									checked' . $mo . ' = [' . implode(',', $cvo) . '];
									checked' . $mo . 'c = ' . count($cvo) . ';
									unchecked' . $mo . ' = [' . implode(',', $xvo) . '];
									unchecked' . $mo . 'c = ' . count($xvo) . ';';
            }
            if ($user['name'] == 'template') {
                $albdisable = 'false';
            } else {
                $albdisable = 'true';
            }
            $grouppart .= '
								break;';
        }
        $grouppart .= '
							}
						for (i=0;i<checkedalbumc;i++) {
							$(checkedalbum[i]).attr(\'checked\',\'checked\');
						}
						for (i=0;i<uncheckedalbumc;i++) {
							$(uncheckedalbum[i]).attr(\'checked\',\'\');
						}';
        foreach ($groups as $user) {
            $grouppart .= '
						for (i=0;i<checkedpagesc;i++) {
							$(checkedpages[i]).attr(\'checked\',\'checked\');
						}
						for (i=0;i<uncheckedpagesc;i++) {
							$(uncheckedpages[i]).attr(\'checked\',\'\');
						}
						for (i=0;i<checkednewsc;i++) {
							$(checkednews[i]).attr(\'checked\',\'checked\');
						}
						for (i=0;i<uncheckednewsc;i++) {
							$(uncheckednews[i]).attr(\'checked\',\'\');
						}';
        }
        $grouppart .= '
						for (i=0;i<rightsc;i++) {
							if ($(rights[i]).val()&target) {
								$(rights[i]).attr(\'checked\',\'checked\');
							} else {
								$(rights[i]).attr(\'checked\',\'\');
							}
						}
					}
				}';
        if (is_array($hisgroup)) {
            $grouppart .= '
				window.onload = function() {';
            foreach ($codelist as $mo) {
                $cv = populateManagedObjectsList($mo, $user['id']);
                switch ($mo) {
                    case 'album':
                        $list = $albumlist;
                        break;
                    case 'pages':
                        $list = $pagelist;
                        break;
                    case 'news':
                        $list = $newslist;
                        break;
                }
                foreach ($list as $moid) {
                    if (in_array($moid, $cv)) {
                        $grouppart .= '
						$(\'#managed_' . $mo . '_' . $i . '_' . postIndexEncode($moid) . '\').attr(\'checked\',\'checked\');';
                    } else {
                        $grouppart .= '
						$(\'#managed_' . $mo . '_' . $i . '_' . postIndexEncode($moid) . '\').attr(\'checked\',\'\');';
                    }
                }
            }
            $grouppart .= '
				}';
        }
        $grouppart .= '
				//]]> -->
			</script>';
        $grouppart .= '<select name="' . $i . 'group" onchange="javascript:groupchange' . $i . '(this);"' . '>' . "\n";
        $grouppart .= '<option value="" title="' . gettext('*no group affiliation') . '">' . gettext('*no group selected') . '</option>' . "\n";
        $selected_hint = gettext('no group affiliation');
        foreach ($groups as $user) {
            if ($user['name'] == 'template') {
                $type = '<strong>' . gettext('Template:') . '</strong> ';
            } else {
                $type = '';
            }
            $hint = $type . '<em>' . html_encode($user['custom_data']) . '</em>';
            if ($group == $user['user']) {
                $selected = ' selected="selected"';
                $selected_hint = $hint;
            } else {
                $selected = '';
            }
            $grouppart .= '<option' . $selected . ' value="' . $user['user'] . '" title="' . sanitize($hint, 3) . '">' . $user['user'] . '</option>' . "\n";
        }
        $grouppart .= '</select>' . "\n";
        $grouppart .= '<span class="hint' . $i . '" id="hint' . $i . '" style="width:15em;">' . $selected_hint . "</span>\n";
    } else {
        if ($group) {
            $grouppart = $group;
        } else {
            $grouppart = gettext('no group affiliation');
        }
        $grouppart = ' <em>' . $grouppart . '</em><input type="hidden" name="' . $i . 'group" value="' . $group . '" />' . "\n";
    }
    $result = '<tr' . (!$current ? ' style="display:none;"' : '') . ' class="userextrainfo">
			<td colspan="2" width="20%"' . (!empty($background) ? ' style="' . $background . '"' : '') . ' valign="top">' . gettext('User group membership') . $grouppart . '<br />' . gettext('<strong>Note:</strong> When a group is assigned <em>rights</em> and <em>managed albums</em> are determined by the group!') . '</td>
			<td' . (!empty($background) ? ' style="' . $background . '"' : '') . ' valign="top" width="345">' . '</td>
			</tr>' . "\n";
    return $html . $result;
}
Пример #7
0
/**
 * Creates the body of an unordered list with checkbox label/input fields (scrollable sortables)
 *
 * @param array $currentValue list of items to be flagged as checked
 * @param array $list the elements of the select list
 * @param string $prefix prefix of the input item
 * @param string $alterrights are the items changable.
 * @param bool $sort true for sorted list
 * @param string $class optional class for items
 * @param bool $localize true if the list local key is text for the item
 */
function generateUnorderedListFromArray($currentValue, $list, $prefix, $alterrights, $sort, $localize, $class = NULL, $extra = NULL)
{
    if (is_null($extra)) {
        $extra = array();
    }
    if (!empty($class)) {
        $class = ' class="' . $class . '" ';
    }
    if ($sort) {
        if ($localize) {
            $list = array_flip($list);
            natcasesort($list);
            $list = array_flip($list);
        } else {
            natcasesort($list);
        }
    }
    $cv = array_flip($currentValue);
    foreach ($list as $key => $item) {
        $listitem = postIndexEncode($prefix . $item);
        if ($localize) {
            $display = $key;
        } else {
            $display = $item;
        }
        ?>
			<li id="<?php 
        echo strtolower($listitem);
        ?>
_element">
				<label class="displayinline">
					<input id="<?php 
        echo strtolower($listitem);
        ?>
"<?php 
        echo $class;
        ?>
 name="<?php 
        echo $listitem;
        ?>
" type="checkbox"
					<?php 
        if (isset($cv[$item])) {
            echo ' checked="checked"';
        }
        ?>
 value="1" <?php 
        echo $alterrights;
        ?>
 />
								 <?php 
        echo html_encode($display);
        ?>
				</label>
				<?php 
        if (array_key_exists($item, $extra)) {
            $unique = '';
            foreach (array_reverse($extra[$item]) as $box) {
                if ($box['display']) {
                    if (isset($box['disable'])) {
                        $disable = ' disabled="disabled"';
                    } else {
                        $disable = $alterrights;
                    }
                    if (isset($box['type'])) {
                        $type = $box['type'];
                        if ($type == 'radio') {
                            $unique++;
                        }
                    } else {
                        $type = 'checkbox';
                    }
                    ?>
							<label class="displayinlineright">
								<input type="<?php 
                    echo $type;
                    ?>
" id="<?php 
                    echo strtolower($listitem) . '_' . $box['name'] . $unique;
                    ?>
"<?php 
                    echo $class;
                    ?>
 name="<?php 
                    echo $listitem . '_' . $box['name'];
                    ?>
"
											 value="<?php 
                    echo html_encode($box['value']);
                    ?>
" <?php 
                    if ($box['checked']) {
                        echo ' checked="checked"';
                    }
                    ?>
											 <?php 
                    echo $disable;
                    ?>
 /> <?php 
                    echo $box['display'];
                    ?>
							</label>
							<?php 
                } else {
                    ?>
							<input type="hidden" id="<?php 
                    echo strtolower($listitem . '_' . $box['name']);
                    ?>
" name="<?php 
                    echo $listitem . '_' . $box['name'];
                    ?>
"<?php 
                    echo $class;
                    ?>
										 value="<?php 
                    echo html_encode($box['value']);
                    ?>
" />
										 <?php 
                }
            }
        }
        ?>
			</li>
			<?php 
    }
}
Пример #8
0
        break;
    case 'cookie':
        ?>
						<div class="tabbox">
							<?php 
        zp_apply_filter('admin_note', 'development', '');
        echo gettext('Site browser cookies found.');
        ?>
							<form name="cookie_form" class="dirtychyeck" method="post" action="?page=develpment&amp;tab=cookie">
								<table class="compact">
									<?php 
        foreach ($_COOKIE as $cookie => $cookiev) {
            ?>
										<tr>
											<td><input type="checkbox" name="delete_cookie[<?php 
            echo html_encode(postIndexEncode($cookie));
            ?>
]" value="1"></td>
											<td><?php 
            echo html_encode($cookie);
            ?>
 </td>
											<td><?php 
            echo html_encode(zp_cookieEncode($cookiev));
            ?>
</td>
										</tr>
										<?php 
        }
        ?>
								</table>
Пример #9
0
    static function groupList($userobj, $i, $background, $current, $template)
    {
        global $_zp_authority;
        $group = $userobj->getGroup();
        $admins = $_zp_authority->getAdministrators('groups');
        $membership = $groups = array();
        $hisgroups = explode(',', $userobj->getGroup());
        $userid = $userobj->getUser();
        $admins = sortMultiArray($admins, 'user');
        foreach ($admins as $user) {
            if (in_array($user['user'], $hisgroups)) {
                $membership[] = $user;
            } else {
                if ($template || $user['name'] != 'template') {
                    $groups[] = $user;
                }
            }
        }
        $groups = array_merge($membership, array(array('name' => '', 'user' => '', 'other_credentials' => '')), $groups);
        if (empty($groups)) {
            return gettext('no groups established');
        }
        // no groups setup yet
        $grouppart = '<ul class="customchecklist scrollable_list" >' . "\n";
        foreach ($groups as $key => $user) {
            if ($user['name'] == 'template') {
                $type = gettext(' (Template)');
                $highlight = ' class="grouphighlight"';
                $class = 'templatelist' . $i;
                $case = 2;
            } else {
                $type = $highlight = '';
                $class = 'grouplist' . $i;
                $case = 1;
            }
            if (in_array($user['user'], $hisgroups)) {
                $checked = ' checked="checked"';
            } else {
                $checked = '';
            }
            if (empty($user['user'])) {
                $display = gettext('*no group selected');
                $case = 0;
                if (empty($hisgroups)) {
                    $checked = ' checked="checked"';
                }
            } else {
                $display = $user['user'];
            }
            $grouppart .= '<label title="' . html_encode($user['other_credentials']) . $type . '"' . $highlight . '><input type="checkbox" class="' . $class . '" name="' . $i . 'group[]" id="' . $user['user'] . '_' . $i . '" value="' . $user['user'] . '" onclick="groupchange' . $i . '(' . $case . ');"' . $checked . ' />' . html_encode($display) . '</label>' . "\n";
        }
        $grouppart .= "</ul>\n";
        $grouppart .= '
		<script type="text/javascript">
			// <!-- <![CDATA[' . "\n";
        if ($primealbum = $userobj->getAlbum()) {
            //	allow editing of primary album management
            $grouppart .= '
			$(\'#managed_albums_list_' . $i . '_' . postIndexEncode($primealbum->name) . '_element\').find(\'input\').removeAttr(\'class\');
				$(\'#managed_albums_list_' . $i . '_' . postIndexEncode($primealbum->name) . '_element\').find(\'input\').removeAttr(\'disabled\');	' . "\n";
        }
        $grouppart .= '
			function groupchange' . $i . '(type) {
				switch (type) {
				case 0:	//	none
					$(\'.user-' . $i . '\').prop(\'disabled\',false);
					$(\'.templatelist' . $i . '\').prop(\'checked\',false);
					$(\'.grouplist' . $i . '\').prop(\'checked\',false);
					$(\'#_' . $i . '\').prop(\'checked\',true);
					break;
				case 1:	//	group
					$(\'#_' . $i . '\').prop(\'disabled\',false);
					$(\'#_' . $i . '\').prop(\'checked\',false);
					$(\'.user-' . $i . '\').prop(\'disabled\',true);
					$(\'.user-' . $i . '\').prop(\'checked\',false);
					$(\'.templatelist' . $i . '\').prop(\'checked\',false);
					break;
				case 2:	//	template
					$(\'.user-' . $i . '\').prop(\'disabled\',false);
					$(\'.grouplist' . $i . '\').prop(\'checked\',false);
					$(\'#_' . $i . '\').prop(\'checked\',false);
					break;
			}
		}
		//]]> -->';
        $grouppart .= '</script>' . "\n";
        return $grouppart;
    }
Пример #10
0
/**
 * Creates the body of an unordered list with checkbox label/input fields (scrollable sortables)
 *
 * @param array $currentValue list of items to be flagged as checked
 * @param array $list the elements of the select list
 * @param string $prefix prefix of the input item
 * @param string $alterrights are the items changable.
 */
function generateUnorderedListFromArray($currentValue, $list, $prefix, $alterrights, $sort, $localize)
{
    if ($sort) {
        if ($localize) {
            $list = array_flip($list);
            natcasesort($list);
            $list = array_flip($list);
        } else {
            natcasesort($list);
        }
    }
    $cv = array_flip($currentValue);
    foreach ($list as $key => $item) {
        $listitem = postIndexEncode($prefix . $item);
        echo '<li><label for="' . $listitem . '"><input id="' . $listitem . '" name="' . $listitem . '" type="checkbox"';
        if (isset($cv[$item])) {
            echo ' checked="checked" ';
        }
        echo ' value="' . $item . '" ';
        if ($localize) {
            $display = $key;
        } else {
            $display = $item;
        }
        echo $alterrights . ' /> ' . $display . "</label></li>" . "\n";
    }
}
Пример #11
0
    $root = SERVERPATH . '/' . THEMEFOLDER . '/' . $_zp_gallery->getCurrentTheme() . '/';
    chdir($root);
    $filelist = safe_glob('*.php');
    $list = array();
    foreach ($filelist as $file) {
        $file = filesystemToInternal($file);
        $list[$file] = str_replace('.php', '', $file);
    }
    chdir($curdir);
    $list = array_diff($list, standardScripts());
    $list['index.php'] = 'index';
    $current = array();
    foreach ($list as $page) {
        ?>
											<input type="hidden" name="gallery-page_<?php 
        echo postIndexEncode($page);
        ?>
" value="0" />
											<?php 
        if ($_zp_gallery->isUnprotectedPage($page)) {
            $current[] = $page;
        }
    }
    ?>
										<ul class="shortchecklist">
											<?php 
    generateUnorderedListFromArray($current, $list, 'gallery_page_unprotected_', false, true, true);
    ?>
										</ul>
									</td>
									<td><?php