/**
 * 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 bool $showLoginForm set to true to display a login form if no one is logged in
 */
function printUserLogout($before = '', $after = '', $showLoginForm = false)
{
    global $cookies;
    if ($showLoginForm) {
        $showLoginForm = !checkforPassword(true);
    }
    if (empty($cookies)) {
        if ($showLoginForm) {
            printPasswordForm('', false);
        }
    } else {
        echo $before . '<a href="?userlog=0" title="' . gettext("logout") . '" >' . gettext("logout") . '</a>' . $after;
    }
}
Beispiel #2
0
include "inc-copy.php";
?>
					</div>
				</div>
			</div>
			<div id="page">
				<div class="post">
					<?php 
if (!zp_loggedin()) {
    ?>
					<div class="error"><?php 
    echo gettext("Please Login");
    ?>
</div>	
					<?php 
    printPasswordForm($hint);
    ?>
					<?php 
} else {
    ?>
					<div class="errorbox">
						<p><?php 
    echo gettext('You are logged in...');
    ?>
</p>
					</div>
					<?php 
}
?>

					<?php 
Beispiel #3
0
		<div id="content">
		<div id="breadcrumb">
	<h2><a href="<?php 
echo getGalleryIndexURL();
?>
">Index</a> &raquo; <strong><?php 
echo gettext("A password is required for the page you requested");
?>
</strong></h2>
	</div>

	<div id="content-error">

		<div class="errorbox">
		<?php 
printPasswordForm($hint, $show);
?>
		</div>

	<?php 
if (!zp_loggedin() && function_exists('printRegistrationForm') && $_zp_gallery->isUnprotectedPage('register')) {
    printCustomPageURL(gettext('Register for this site'), 'register', '', '<br />');
    echo '<br />';
}
?>
</div>


<div id="footer">
	<?php 
include "footer.php";
 *
 * Where <zenphoto install root> is the URL of your zenphoto root folder, e.g. http://myhost.com/zenphoto
 *
 * Of course, modify the style of this script to fit your needs.
 */
require_once dirname(__FILE__) . '/zp-core/global-definitions.php';
define('OFFSET_PATH', 0);
require_once ZENFOLDER . "/template-functions.php";
checkInstall();
if (!is_null($_zp_current_admin_obj)) {
    if ($_zp_loggedin & ADMIN_RIGHTS) {
        header("Location: " . WEBPATH . "/");
    } else {
        $albums = getManagedAlbumList();
        $album = array_shift($albums);
        header("Location: " . WEBPATH . "/" . $album . '/');
    }
}
header('Content-Type: text/html; charset=' . getOption('charset'));
?>
<html>
<head>
<title>Zenphoto Single_login</title>
</head>
<body>
<?php 
printPasswordForm('', true, false, "#");
?>
</body>
</html>
Beispiel #5
0
 $hash = getOption('downloadList_password');
 if (GALLERY_SECURITY != 'public' || $hash) {
     //	credentials required to download
     if (!zp_loggedin(getOption('downloadList_rights') ? FILES_RIGHTS : ALL_RIGHTS)) {
         $user = getOption('downloadList_user');
         zp_handle_password('download_auth', $hash, $user);
         if (!empty($hash) && zp_getCookie('download_auth') != $hash) {
             $show = $user ? true : NULL;
             $hint = '';
             if (!empty($hash)) {
                 $hint = get_language_string(getOption('downloadList_hint'));
             }
             if (isset($_GET['albumzip'])) {
                 $item .= '&albumzip';
             }
             printPasswordForm($hint, true, $show, '?download=' . $item);
             exitZP();
         }
     }
 }
 if (isset($_GET['albumzip'])) {
     DownloadList::updateListItemCount($item . '.zip');
     require_once SERVERPATH . '/' . ZENFOLDER . '/lib-zipStream.php';
     if (isset($_GET['fromcache'])) {
         $fromcache = sanitize($isset($_GET['fromcache']));
     } else {
         $fromcache = getOption('downloadList_zipFromCache');
     }
     AlbumZip::create($item, $fromcache);
     exitZP();
 } else {
/**
 * places the user registration form
 *
 * @param string $thanks the message shown on successful registration
 */
function printRegistrationForm($thanks = NULL)
{
    global $notify, $admin_e, $admin_n, $user;
    if (zp_loggedin()) {
        if (isset($_GET['userlog']) && $_GET['userlog'] == 1) {
            echo '<meta HTTP-EQUIV="REFRESH" content="0; url=/">';
        } else {
            echo '<div class="errorbox" id="fade-message">';
            echo '<h2>' . gettext("you are already logged in.") . '</h2>';
            echo '</div>';
        }
        return;
    }
    if (isset($notify)) {
        if ($notify == 'verified' || $notify == 'accepted') {
            if ($notify == 'verified') {
                if (is_null($thanks)) {
                    $thanks = gettext("Thank you for registering.");
                }
            } else {
                $thanks = gettext('An email has been sent to you to verify your email address.');
            }
            echo '<div class="Messagebox" id="fade-message">';
            echo '<h2>' . gettext('Your registration has been accepted.') . '</h2>';
            echo '<p>' . $thanks . '</p>';
            echo '</div>';
            if (function_exists('printUserLogout') && $notify == 'verified') {
                ?>
				<p><?php 
                echo gettext('You may now log onto the site.');
                ?>
</p>
				<?php 
                printPasswordForm('', false, true);
            }
            $notify = 'success';
        } else {
            echo '<div class="errorbox" id="fade-message">';
            echo '<h2>' . gettext("Registration failed.") . '</h2>';
            echo '<p>';
            switch ($notify) {
                case 'exists':
                    echo gettext('The user ID you chose is already in use.');
                    break;
                case 'mismatch':
                    echo gettext('Your passwords did not match.');
                    break;
                case 'incomplete':
                    echo gettext('You have not filled in all the fields.');
                    break;
                case 'notverified':
                    echo gettext('Invalid verification link.');
                    break;
                case 'invalidemail':
                    echo gettext('Enter a valid email address.');
                    break;
            }
            echo '</p>';
            echo '</div>';
        }
    }
    if ($notify != 'success') {
        require_once dirname(__FILE__) . '/' . substr(basename(__FILE__), 0, -4) . '/' . 'register_user_form.php';
    }
}
Beispiel #7
0
$t = new Template(translate('Forgot Password'));
// Print HTML header
$t->printHTMLHeader();
// Start main table
$t->startMain();
// Set status to false so we print the form by default
$status = false;
// Determine if we are changing the password
if (isset($_POST['email_address']) && strstr($_SERVER['HTTP_REFERER'], $_SERVER['PHP_SELF'])) {
    $status = changePassword();
}
// Print form or success message
if ($status) {
    printSuccess();
} else {
    printPasswordForm();
}
// End main table
$t->endMain();
// Print HTML footer
$t->printHTMLFooter();
/**
* Print password form
* This function prints out a form allowing
*  a user to enter their email to change
*  their forgotten password
* @param none
*/
function printPasswordForm()
{
    ?>
/**
 * Checks to see if a password is needed
 * displays a password form if log-on is required
 *
 * Returns true if a login form has been displayed
 *
 * The password protection is hereditary. This normally only impacts direct url access to an album or image since if
 * you are going down the tree you will be stopped at the first place a password is required.
 *
 * If the gallery is password protected then every album & image will require that password.
 *
 * If an album is password protected then all subalbums and images treed below that album will require
 * the password. If there are multiple passwords in the tree and you direct link, the password that is
 * required will be that of the nearest parent that has a password. (The gallery is the ur-parrent to all
 * albums.)
 *
 * @param bool $silent set to true to inhibit the logon form
 * @return bool
 * @since 1.1.3
 */
function checkforPassword($silent = false)
{
    global $_zp_current_album, $_zp_current_search, $_zp_gallery, $_zp_loggedin;
    if (zp_loggedin(MAIN_RIGHTS | VIEWALL_RIGHTS | ALL_ALBUMS_RIGHTS)) {
        return false;
    }
    // you're the admin, you don't need the passwords.
    if (in_context(ZP_SEARCH)) {
        // search page
        $hash = getOption('search_password');
        $show = getOption('search_user') != '';
        $hint = get_language_string(getOption('search_hint'));
        $authType = 'zp_search_auth';
        if (empty($hash)) {
            $hash = getOption('gallery_password');
            $show = getOption('gallery_user') != '';
            $hint = get_language_string(getOption('gallery_hint'));
            $authType = 'zp_gallery_auth';
        }
        if (!empty($hash)) {
            if (zp_getCookie($authType) != $hash) {
                if (!$silent) {
                    printPasswordForm($hint, true, getOption('login_user_field') || $show);
                }
                return true;
            }
        }
    } else {
        if (isset($_GET['album'])) {
            // album page
            list($album, $image) = rewrite_get_album_image('album', 'image');
            if (checkAlbumPassword($album, $hint)) {
                return false;
            } else {
                if (!$silent) {
                    $alb = new Album($_zp_gallery, $album);
                    printPasswordForm($hint, true, getOption('login_user_field') || $alb->getUser() != '');
                }
                return true;
            }
        } else {
            // index page
            if ($_zp_loggedin) {
                return false;
            }
            $hash = getOption('gallery_password');
            $hint = get_language_string(getOption('gallery_hint'));
            if (!empty($hash)) {
                if (zp_getCookie('zp_gallery_auth') != $hash) {
                    if (!$silent) {
                        printPasswordForm($hint, true, getOption('login_user_field') || getOption('gallery_user') != '');
                    }
                    return true;
                }
            }
        }
    }
    return false;
}
Beispiel #9
0
/**
 * Parses the verification and registration if they have occurred
 * places the user registration form
 *
 * @param string $thanks the message shown on successful registration
 */
function printRegistrationForm($thanks = NULL)
{
    global $admin_e, $admin_n, $user, $_zp_authority, $_zp_captcha, $_zp_gallery, $_notify, $_link, $_message;
    require_once SERVERPATH . '/' . ZENFOLDER . '/admin-functions.php';
    $userobj = NULL;
    // handle any postings
    if (isset($_GET['verify'])) {
        $currentadmins = $_zp_authority->getAdministrators();
        $params = unserialize(pack("H*", trim(sanitize($_GET['verify']), '.')));
        // expung the verify query string as it will cause us to come back here if login fails.
        unset($_GET['verify']);
        $_link = explode('?', getRequestURI());
        $p = array();
        if (isset($_link[1])) {
            $p = explode('&', $_link[1]);
            foreach ($p as $k => $v) {
                if (strpos($v, 'verify=') === 0) {
                    unset($p[$k]);
                }
            }
            unset($p['verify']);
        }
        $_SERVER['REQUEST_URI'] = $_link[0];
        if (!empty($p)) {
            $_SERVER['REQUEST_URI'] .= '?' . implode('&', $p);
        }
        $userobj = $_zp_authority->getAnAdmin(array('`user`=' => $params['user'], '`valid`=' => 1));
        if ($userobj && $userobj->getEmail() == $params['email']) {
            if (!$userobj->getRights()) {
                $userobj->setCredentials(array('registered', 'user', 'email'));
                $rights = getOption('register_user_user_rights');
                $group = NULL;
                if (!is_numeric($rights)) {
                    //  a group or template
                    $admin = $_zp_authority->getAnAdmin(array('`user`=' => $rights, '`valid`=' => 0));
                    if ($admin) {
                        $userobj->setObjects($admin->getObjects());
                        if ($admin->getName() != 'template') {
                            $group = $rights;
                        }
                        $rights = $admin->getRights();
                    } else {
                        $rights = NO_RIGHTS;
                    }
                }
                $userobj->setRights($rights | NO_RIGHTS);
                $userobj->setGroup($group);
                zp_apply_filter('register_user_verified', $userobj);
                if (getOption('register_user_notify')) {
                    $_notify = zp_mail(gettext('ZenPhoto20 Gallery registration'), sprintf(gettext('%1$s (%2$s) has registered for the zenphoto gallery providing an e-mail address of %3$s.'), $userobj->getName(), $userobj->getUser(), $userobj->getEmail()));
                }
                if (empty($_notify)) {
                    if (getOption('register_user_create_album')) {
                        $userobj->createPrimealbum();
                    }
                    $_notify = 'verified';
                    $_POST['user'] = $userobj->getUser();
                }
                $userobj->save();
            } else {
                $_notify = 'already_verified';
            }
        } else {
            $_notify = 'not_verified';
            // User ID no longer exists
        }
    }
    if (isset($_GET['login'])) {
        //presumably the user failed to login....
        $_notify = 'loginfailed';
    }
    if (zp_loggedin()) {
        if (isset($_GET['login'])) {
            echo '<meta http-equiv="refresh" content="1; url=' . WEBPATH . '/">';
        } else {
            echo '<div class="errorbox fade-message">';
            echo '<h2>' . gettext("you are already logged in.") . '</h2>';
            echo '</div>';
        }
        return;
    }
    if (isset($_GET['login'])) {
        //presumably the user failed to login....
        $_notify = 'loginfailed';
    }
    if (!empty($_notify)) {
        switch ($_notify) {
            case 'verified':
                if (is_null($thanks)) {
                    $thanks = gettext("Thank you for registering.");
                }
                ?>
				<div class="Messagebox fade-message">
					<p><?php 
                echo $thanks;
                ?>
</p>
					<p><?php 
                echo gettext('You may now log onto the site and verify your personal information.');
                ?>
</p>
				</div>
			<?php 
            case 'already_verified':
            case 'loginfailed':
                $_link = getRequestURI();
                if (strpos($_link, '?') === false) {
                    $_SERVER['REQUEST_URI'] = $_link . '?login=true';
                } else {
                    $_SERVER['REQUEST_URI'] = $_link . '&login=true';
                }
                require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/user_login-out.php';
                printPasswordForm(NULL, true, false, WEBPATH . '/' . ZENFOLDER . '/admin-users.php?page=users');
                $_notify = 'success';
                break;
            case 'honeypot':
                //pretend it was accepted
            //pretend it was accepted
            case 'accepted':
                ?>
				<div class="Messagebox fade-message">
					<p><?php 
                echo gettext('Your registration information has been accepted. An email has been sent to you to verify your email address.');
                ?>
</p>
				</div>
				<?php 
                if ($_notify != 'honeypot') {
                    $_notify = 'success';
                }
                // of course honeypot catches are no success!
                break;
            case 'exists':
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Registration failed.");
                ?>
</h2>
					<p><?php 
                printf(gettext('The user ID <em>%s</em> is already in use.'), $user);
                ?>
</p>
				</div>
				<?php 
                break;
            case 'dup_email':
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Registration failed.");
                ?>
</h2>
					<p><?php 
                printf(gettext('A user with the e-mail <em>%s</em> already exists.'), $admin_e);
                ?>
</p>
				</div>
				<?php 
                break;
            case 'empty':
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Registration failed.");
                ?>
</h2>
					<p><?php 
                echo gettext('Passwords may not be empty.');
                ?>
</p>
				</div>
				<?php 
                break;
            case 'mismatch':
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Registration failed.");
                ?>
</h2>
					<p><?php 
                echo gettext('Your passwords did not match.');
                ?>
</p>
				</div>
				<?php 
                break;
            case 'incomplete':
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Registration failed.");
                ?>
</h2>
					<p><?php 
                echo gettext('You have not filled in all the fields.');
                ?>
</p>
				</div>
				<?php 
                break;
            case 'notverified':
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Registration failed.");
                ?>
</h2>
					<p><?php 
                echo gettext('Invalid verification link.');
                ?>
</p>
				</div>
				<?php 
                break;
            case 'invalidemail':
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Registration failed.");
                ?>
</h2>
					<p><?php 
                echo gettext('Enter a valid email address.');
                ?>
</p>
				</div>
				<?php 
                break;
            case 'invalidcaptcha':
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Registration failed.");
                ?>
</h2>
					<p><?php 
                echo gettext('The CAPTCHA you entered was not correct.');
                ?>
</p>
				</div>
				<?php 
                break;
            case 'not_verified':
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Verification failed.");
                ?>
</h2>
					<p><?php 
                echo gettext('Your registration request could not be completed.');
                ?>
</p>
				</div>
				<?php 
                break;
            case 'filter':
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Registration failed.");
                ?>
</h2>
					<p>
				<?php 
                if (is_object($userobj) && !empty($userobj->msg)) {
                    echo $userobj->msg;
                } else {
                    echo gettext('Your registration attempt failed a <code>register_user_registered</code> filter check.');
                }
                ?>
					</p>
				</div>
				<?php 
                break;
            default:
                ?>
				<div class="errorbox fade-message">
					<h2><?php 
                echo gettext("Registration failed.");
                ?>
</h2>
					<p><?php 
                echo $_notify;
                ?>
</p>
				</div>
				<?php 
                break;
        }
    }
    if ($_notify != 'success') {
        $form = getPlugin('register_user/register_user_form.php', true);
        require_once $form;
    }
}
Beispiel #10
0
include 'inc_header.php';
?>

	<!-- wrap -->
		<!-- container -->
			<!-- header -->
				<h3><?php 
echo gettext('Password required');
?>
</h3>
			</div> <!-- /header -->

			<div class="row">
				<div class="span12">
					<div class="post">
						<?php 
printPasswordForm('', true);
?>
						<script type="text/javascript">
							jQuery(document).ready(function($) {
								$('#zpB_passwordform').modal({
									show: true
								});
							});
						</script>
					</div>
				</div>
			</div>

<?php 
include 'inc_footer.php';
Beispiel #11
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
 * 				to not display a login form, but just a login link, set to 0
 * 				to display a login form set to 1
 * 				to display a link to a login form in colorbox, set to 2, but you must have colorbox enabled for the theme pages where this link appears.)
 * @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 (getOption('colorbox_' . $_zp_gallery->getCurrentTheme() . '_' . stripSuffix($_zp_gallery_page)) && zp_has_filter('theme_head', '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', getCustomPageURL('password'))) {
                        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>';
        }
    }
}
Beispiel #12
0
        $show = $_zp_gallery->getUser();
    }
    if (empty($hash) && GALLERY_SECURITY == 'private' || !empty($hash) && zp_getCookie($authType) != $hash) {
        require_once dirname(__FILE__) . "/template-functions.php";
        $parms = '';
        if (isset($_GET['wmk'])) {
            $parms = '&wmk=' . $_GET['wmk'];
        }
        if (isset($_GET['q'])) {
            $parms .= '&q=' . sanitize_numeric($_GET['q']);
        }
        if (isset($_GET['dsp'])) {
            $parms .= '&dsp=' . sanitize_numeric($_GET['dsp']);
        }
        $action = WEBPATH . '/' . ZENFOLDER . '/full-image.php?userlog=1&a=' . pathurlencode($album8) . '&i=' . urlencode($image8) . $parms;
        printPasswordForm($hint, true, $_zp_gallery->getUserLogonField() || $show, $action);
        exit;
    }
    exit;
}
$image_path = ALBUM_FOLDER_SERVERPATH . $album . '/' . $image;
$suffix = getSuffix($image_path);
$cache_file = $album . "/" . substr($image, 0, -strlen($suffix) - 1) . '_FULL.' . $suffix;
switch ($suffix) {
    case 'bmp':
        $suffix = 'wbmp';
        break;
    case 'jpg':
        $suffix = 'jpeg';
        break;
    case 'png':
/**
 * Parses the verification and registration if they have occurred
 * places the user registration form
 *
 * @param string $thanks the message shown on successful registration
 */
function printRegistrationForm($thanks = NULL)
{
    global $notify, $admin_e, $admin_n, $user, $_zp_authority, $_zp_captcha, $_zp_gallery_page, $_zp_gallery;
    require_once dirname(dirname(__FILE__)) . '/admin-functions.php';
    $userobj = NULL;
    // handle any postings
    if (isset($_GET['verify'])) {
        $currentadmins = $_zp_authority->getAdministrators();
        $params = unserialize(pack("H*", trim(sanitize($_GET['verify']), '.')));
        $userobj = $_zp_authority->getAnAdmin(array('`user`=' => $params['user'], '`valid`=' => 1));
        if ($userobj->getEmail() == $params['email']) {
            if (!$userobj->getRights()) {
                $userobj->setCredentials(array('registered', 'user', 'email'));
                $rights = getOption('register_user_user_rights');
                $group = NULL;
                if (!is_numeric($rights)) {
                    //  a group or template
                    $admin = $_zp_authority->getAnAdmin(array('`user`=' => $rights, '`valid`=' => 0));
                    if ($admin) {
                        $userobj->setObjects($admin->getObjects());
                        if ($admin->getName() != 'template') {
                            $group = $rights;
                        }
                        $rights = $admin->getRights();
                    } else {
                        $rights = NO_RIGHTS;
                    }
                }
                $userobj->setRights($rights | NO_RIGHTS);
                $userobj->setGroup($group);
                zp_apply_filter('register_user_verified', $userobj);
                $notify = false;
                if (getOption('register_user_notify')) {
                    $notify = zp_mail(gettext('Zenphoto Gallery registration'), sprintf(gettext('%1$s (%2$s) has registered for the zenphoto gallery providing an e-mail address of %3$s.'), $userobj->getName(), $userobj->getUser(), $userobj->getEmail()));
                }
                if (empty($notify)) {
                    if (getOption('register_user_create_album')) {
                        $userobj->createPrimealbum();
                    }
                    $notify = 'verified';
                    $_POST['user'] = $userobj->getUser();
                }
                $userobj->save();
            } else {
                $notify = 'verified';
            }
        } else {
            $notify = 'not_verified';
            // User ID no longer exists
        }
    }
    if (isset($_POST['register_user'])) {
        if (getOption('register_user_captcha')) {
            if (isset($_POST['code'])) {
                $code = sanitize($_POST['code'], 3);
                $code_ok = sanitize($_POST['code_h'], 3);
            } else {
                $code = '';
                $code_ok = '';
            }
            if (!$_zp_captcha->checkCaptcha($code, $code_ok)) {
                $notify = 'invalidcaptcha';
            }
        }
        $admin_n = trim(sanitize($_POST['admin_name']));
        if (empty($admin_n)) {
            $notify = 'incomplete';
        }
        if (isset($_POST['admin_email'])) {
            $admin_e = trim(sanitize($_POST['admin_email']));
        } else {
            $admin_e = trim(sanitize($_POST['adminuser']));
        }
        if (!is_valid_email_zp($admin_e)) {
            $notify = 'invalidemail';
        }
        $pass = trim(sanitize($_POST['adminpass']));
        $user = trim(sanitize($_POST['adminuser']));
        if (!empty($user) && !empty($admin_n) && !empty($admin_e)) {
            if ($pass == trim(sanitize($_POST['adminpass_2']))) {
                $currentadmin = $_zp_authority->getAnAdmin(array('`user`=' => $user, '`valid`>' => 0));
                if (is_object($currentadmin)) {
                    $notify = 'exists';
                }
                if (empty($notify)) {
                    $notify = $_zp_authority->validatePassword($pass);
                    //	test for valid password
                    if (empty($notify)) {
                        $userobj = $_zp_authority->newAdministrator('');
                        $userobj->transient = false;
                        $userobj->setUser($user);
                        $userobj->setPass($pass);
                        $userobj->setName($admin_n);
                        $userobj->setEmail($admin_e);
                        $userobj->setRights(0);
                        $userobj->setObjects(NULL);
                        $userobj->setGroup('');
                        $userobj->setCustomData('');
                        $userobj->setLanguage(getUserLocale());
                        zp_apply_filter('register_user_registered', $userobj);
                        if ($userobj->transient) {
                            if (empty($notify)) {
                                $notify = 'filter';
                            }
                        } else {
                            $userobj->save();
                            $link = rewrite_path(FULLWEBPATH . '/page/' . substr($_zp_gallery_page, 0, -4) . '?verify=' . bin2hex(serialize(array('user' => $user, 'email' => $admin_e))), FULLWEBPATH . '/index.php?p=' . substr($_zp_gallery_page, 0, -4) . '&verify=' . bin2hex(serialize(array('user' => $user, 'email' => $admin_e))), false);
                            $message = sprintf(get_language_string(getOption('register_user_text')), $link);
                            $notify = zp_mail(get_language_string(gettext('Registration confirmation')), $message, array($user => $admin_e));
                            if (empty($notify)) {
                                $notify = 'accepted';
                            }
                        }
                    }
                }
            } else {
                $notify = 'mismatch';
            }
        } else {
            $notify = 'incomplete';
        }
    }
    if (zp_loggedin()) {
        if (isset($_GET['userlog']) && $_GET['userlog'] == 1) {
            echo '<meta http-equiv="refresh" content="1; url=' . WEBPATH . '/">';
        } else {
            echo '<div class="errorbox fade-message">';
            echo '<h2>' . gettext("you are already logged in.") . '</h2>';
            echo '</div>';
        }
        return;
    }
    if (!empty($notify)) {
        if ($notify == 'verified' || $notify == 'accepted') {
            ?>
			<div class="Messagebox fade-message">
				<p>
				<?php 
            if ($notify == 'verified') {
                if (is_null($thanks)) {
                    $thanks = gettext("Thank you for registering.");
                }
                echo $thanks;
            } else {
                echo gettext('Your registration information has been accepted. An email has been sent to you to verify your email address.');
            }
            ?>
				</p>
			</div>
			<?php 
            if ($notify == 'verified') {
                require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/user_login-out.php';
                ?>
				<p><?php 
                echo gettext('You may now log onto the site.');
                ?>
</p>
				<?php 
                printPasswordForm('', false, true, WEBPATH . '/' . ZENFOLDER . '/admin.php');
            }
            $notify = 'success';
        } else {
            echo '<div class="errorbox fade-message">';
            echo '<h2>' . gettext("Registration failed.") . '</h2>';
            echo '<p>';
            switch ($notify) {
                case 'exists':
                    printf(gettext('The user ID <em>%s</em> is already in use.'), $admin_e);
                    break;
                case 'mismatch':
                    echo gettext('Your passwords did not match.');
                    break;
                case 'incomplete':
                    echo gettext('You have not filled in all the fields.');
                    break;
                case 'notverified':
                    echo gettext('Invalid verification link.');
                    break;
                case 'invalidemail':
                    echo gettext('Enter a valid email address.');
                    break;
                case 'invalidcaptcha':
                    echo gettext('The CAPTCHA you entered was not correct.');
                    break;
                case 'not_verified':
                    echo gettext('Your registration request could not be completed.');
                    break;
                case 'filter':
                    if (is_object($userobj) && !empty($userobj->msg)) {
                        echo $userobj->msg;
                    } else {
                        echo gettext('Your registration attempt failed a <code>register_user_registered</code> filter check.');
                    }
                    break;
                default:
                    echo $notify;
                    break;
            }
            echo '</p>';
            echo '</div>';
        }
    }
    if ($notify != 'success') {
        $form = getPlugin('register_user/register_user_form.php', true);
        require_once $form;
    }
}
/**
 * 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 bool $showLoginForm set to true to display a login form if no one is logged in
 * @param string $logouttext optional replacement text for "Logout"
 */
function printUserLogin_out($before = '', $after = '', $showLoginForm = NULL, $logouttext = NULL)
{
    global $__redirect;
    $cookies = array();
    $candidate = array();
    if (isset($_COOKIE)) {
        $candidate = $_COOKIE;
    }
    if (isset($_SESSION)) {
        $candidate = array_merge($candidate, $_SESSION);
    }
    $candidate = array_unique($candidate);
    foreach ($candidate as $cookie => $value) {
        if ($cookie == 'zenphoto_auth' || $cookie == 'zp_gallery_auth' || $cookie == 'zp_search_auth' || $cookie == 'zp_image_auth' || strpos($cookie, 'zp_album_auth_') !== false || strpos($cookie, 'zp_page_auth_') !== false || strpos($cookie, 'zp_category_auth_') !== false) {
            $cookies[] = $cookie;
        }
    }
    if (is_null($logouttext)) {
        $logouttext = gettext("Logout");
    }
    if (is_null($showLoginForm) && getOption('user_logout_login_form')) {
        $showLoginForm = true;
    }
    if (empty($cookies)) {
        if ($showLoginForm) {
            ?>
			<div class="passwordform">
				<?php 
            printPasswordForm('', false);
            ?>
			</div>
			<?php 
        }
    } else {
        $params = array("'userlog=0'");
        if (!empty($__redirect)) {
            foreach ($__redirect as $param => $value) {
                $params[] .= "'" . $param . '=' . urlencode($value) . "'";
            }
        }
        echo "\n" . $before;
        ?>
		<a href="javascript:launchScript('<?php 
        echo FULLWEBPATH . '/';
        ?>
',[<?php 
        echo implode(',', $params);
        ?>
]);" title="<?php 
        echo $logouttext;
        ?>
" ><?php 
        echo $logouttext;
        ?>
</a>
		<?php 
        echo $after . "\n";
    }
}
Beispiel #15
0
?>
" title="<?php 
echo gettext('Gallery Index');
?>
"><?php 
echo getGalleryTitle();
?>
</a></span> | <?php 
echo gettext("A password is required for the page you requested");
?>
</h2>
		</div>

		<hr />
		<?php 
printPasswordForm(NULL, false);
?>
		<br /><br />
	<div id="credit">
	<?php 
printZenphotoLink();
?>
 	</div>

</div>

<?php 
zp_apply_filter('theme_body_close');
?>

</body>
Beispiel #16
0
							<div class="left-corner">
								<!-- begin content -->
								<div class="main section" id="main">
									<h2 id="gallerytitle">
										<?php 
printHomeLink('', ' » ');
printGalleryIndexURL(' » ');
echo "<em>" . gettext('Password required') . "</em>";
?>
									</h2>
									<h3><?php 
echo gettext('A password is required to access this page.');
?>
</h3>
									<?php 
printPasswordForm('', true, false);
footer();
?>
									<p style="clear: both;"></p>
								</div>
								<!-- end content -->
								<span class="clear"></span> </div>
						</div>
					</div>
				</div>
				<span class="clear"></span>
			</div><!-- /container -->
		</div>
		<?php 
zp_apply_filter('theme_body_close');
?>
Beispiel #17
0
" title="<?php 
echo gettext('Gallery Index');
?>
"><?php 
printGalleryTitle();
?>
</a>
					</span> |
					<?php 
echo gettext("A password is required for the page you requested");
?>
				</h2>
			</div>
			<div id="padbox">
				<?php 
printPasswordForm($hint, $show, false);
?>
			</div>
		</div>
		<div id="credit">
			<?php 
if (!zp_loggedin() && function_exists('printRegisterURL') && $_zp_gallery->isUnprotectedPage('register')) {
    echo '<p>';
    printRegisterURL(gettext('Register for this site'), '<br />');
    echo '</p>';
}
?>
			<?php 
printSoftwareLink();
?>
		</div>
Beispiel #18
0
<?php

global $_zp_themeroot;
?>
<div id="gallery-desc" class="password">
	<img src='<?php 
echo $_zp_themeroot;
?>
/resources/images/lock.png' width='48' height='48' />
	<div class='text'><?php 
printGalleryDesc();
?>
</div>
</div>	
<div id="page-content">
	<div id="password-form-wrapper">
		<?php 
//if we're here, password should be required.
//always print form, no matter what checkforPAssword may return
//if ( checkforPassword(true) ) :
$show = getOption('search_user') != '';
$hint = get_language_string(getOption('search_hint'));
printPasswordForm($hint, true, getOption('login_user_field') || $show);
//endif;
?>
	</div>
</div>