Example #1
0
function list_photos($csn = "", $uid = "")
{
    global $xoopsModuleConfig, $xoopsTpl, $tadgallery;
    if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/fancybox.php")) {
        redirect_header("index.php", 3, _MA_NEED_TADTOOLS);
    }
    include_once XOOPS_ROOT_PATH . "/modules/tadtools/fancybox.php";
    if ($csn) {
        $tadgallery->set_orderby("photo_sort");
        $tadgallery->set_view_csn($csn);
        $tadgallery->set_only_thumb($xoopsModuleConfig['only_thumb']);
        $cate = $tadgallery->get_tad_gallery_cate($csn);
        $xoopsTpl->assign("cate", $cate);
        $upload_powers = $tadgallery->chk_cate_power("upload");
        if ($upload_powers) {
            include_once XOOPS_ROOT_PATH . "/modules/tadtools/jeditable.php";
            $file = "save.php";
            $jeditable = new jeditable();
            $jeditable->setTextAreaCol("#content", $file, '90%', '100px', "{'csn':{$csn},'op' : 'save'}", _MD_TADGAL_EDIT_CATE_CONTENT);
            $jeditable_set = $jeditable->render();
            $xoopsTpl->assign("jeditable_set", $jeditable_set);
        }
    } else {
        $tadgallery->set_orderby("rand");
        $tadgallery->set_limit($xoopsModuleConfig['thumbnail_number']);
    }
    $tadgallery->get_photos();
    $tadgallery->get_albums();
    $cate_fancybox = new fancybox('.editbtn');
    $cate_fancybox_code = $cate_fancybox->render(false);
    $xoopsTpl->assign('cate_fancybox_code', $cate_fancybox_code);
    if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/colorbox.php")) {
        redirect_header("index.php", 3, _MA_NEED_TADTOOLS);
    }
    include_once XOOPS_ROOT_PATH . "/modules/tadtools/colorbox.php";
    $colorbox = new colorbox('.Photo');
    $colorbox_code = $colorbox->render(false);
    $xoopsTpl->assign('colorbox_code', $colorbox_code);
    $xoopsTpl->assign('only_thumb', $xoopsModuleConfig['only_thumb']);
}
Example #2
0
/**
 * Prints the logout link if the user is logged in.
 * This is for album passwords only, not admin users;
 *
 * @param string $before before text
 * @param string $after after text
 * @param int $showLoginForm to display a login form
 * 				0: to not display a login form, but just a login link
 * 				1: to display a login form
 * 				2: to display a link to a login form which will display in colorbox if the colorbox_js plugin is enabled.
 * @param string $logouttext optional replacement text for "Logout"
 */
function printUserLogin_out($before = '', $after = '', $showLoginForm = NULL, $logouttext = NULL)
{
    global $_zp_gallery, $__redirect, $_zp_current_admin_obj, $_zp_login_error, $_zp_gallery_page;
    $excludedPages = array('password.php', 'register.php', 'favorites.php', '404.php');
    $logintext = gettext('Login');
    if (is_null($logouttext)) {
        $logouttext = gettext("Logout");
    }
    $params = array("'userlog=0'");
    if (!empty($__redirect)) {
        foreach ($__redirect as $param => $value) {
            $params[] .= "'" . $param . '=' . urlencode($value) . "'";
        }
    }
    if (is_null($showLoginForm)) {
        $showLoginForm = getOption('user_logout_login_form');
    }
    if (is_object($_zp_current_admin_obj)) {
        if (!$_zp_current_admin_obj->logout_link) {
            return;
        }
    }
    $cookies = Zenphoto_Authority::getAuthCookies();
    if (empty($cookies) || !zp_loggedin()) {
        if (!in_array($_zp_gallery_page, $excludedPages)) {
            switch ($showLoginForm) {
                case 1:
                    ?>
					<div class="passwordform">
						<?php 
                    printPasswordForm('', true, false);
                    ?>
					</div>
					<?php 
                    break;
                case 2:
                    if (extensionEnabled('colorbox_js')) {
                        if (!zp_has_filter('theme_head', 'colorbox::css')) {
                            colorbox::css();
                        }
                        ?>
						<script type="text/javascript">
							// <!-- <![CDATA[
							$(document).ready(function () {
								$(".logonlink").colorbox({
									inline: true,
									innerWidth: "400px",
									href: "#passwordform",
									close: '<?php 
                        echo gettext("close");
                        ?>
',
									open: $('#passwordform_enclosure .errorbox').length
								});
							});
							// ]]> -->
						</script>
						<?php 
                        if ($before) {
                            echo '<span class="beforetext">' . html_encodeTagged($before) . '</span>';
                        }
                        ?>
						<a href="#" class="logonlink" title="<?php 
                        echo $logintext;
                        ?>
"><?php 
                        echo $logintext;
                        ?>
</a>
						<span id="passwordform_enclosure" style="display:none">
							<div class="passwordform">
								<?php 
                        printPasswordForm('', true, false);
                        ?>
							</div>
						</span>
						<?php 
                        if ($after) {
                            echo '<span class="aftertext">' . html_encodeTagged($after) . '</span>';
                        }
                        break;
                    }
                default:
                    if ($loginlink = zp_apply_filter('login_link', PROTOCOL . '://' . $_SERVER['HTTP_HOST'] . WEBPATH . "/" . ZENFOLDER . '/admin.php')) {
                        if ($before) {
                            echo '<span class="beforetext">' . html_encodeTagged($before) . '</span>';
                        }
                        ?>
						<a href="<?php 
                        echo $loginlink;
                        ?>
" title="<?php 
                        echo $logintext;
                        ?>
"><?php 
                        echo $logintext;
                        ?>
</a>
						<?php 
                        if ($after) {
                            echo '<span class="aftertext">' . html_encodeTagged($after) . '</span>';
                        }
                    }
            }
        }
    } else {
        if ($before) {
            echo '<span class="beforetext">' . html_encodeTagged($before) . '</span>';
        }
        $logoutlink = "javascript:launchScript('" . FULLWEBPATH . "/',[" . implode(',', $params) . "]);";
        ?>
		<a href="<?php 
        echo $logoutlink;
        ?>
" title="<?php 
        echo $logouttext;
        ?>
"><?php 
        echo $logouttext;
        ?>
</a>
		<?php 
        if ($after) {
            echo '<span class="aftertext">' . html_encodeTagged($after) . '</span>';
        }
    }
}