当前位置: 首页>>代码示例>>PHP>>正文


PHP zp_mail函数代码示例

本文整理汇总了PHP中zp_mail函数的典型用法代码示例。如果您正苦于以下问题:PHP zp_mail函数的具体用法?PHP zp_mail怎么用?PHP zp_mail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了zp_mail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendMail

 static function sendMail()
 {
     $subject = sanitize($_POST['subject']);
     $message = sanitize($_POST['message'], 1);
     $headers = sanitize($_POST['headers']);
     $mailaddress = sanitize($_POST['mailaddress']);
     $contactform_mailaddress = getOption("contactform_mailaddress");
     $contactform_mailaddress = str_replace(" ", "", $contactform_mailaddress);
     zp_mail($subject, $message, $headers, array($contactform_mailaddress, $mailaddress));
 }
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:10,代码来源:PluginOverrides.php

示例2: save

 static function save($savemsg, $userobj, $what)
 {
     global $_zp_gallery;
     if ($what == 'new' && ($mail = $userobj->getEmail())) {
         $ref = Zenphoto_Authority::getResetTicket($adm = $userobj->getUser(), $userobj->getPass());
         $msg = "\n" . sprintf(gettext('You are receiving this e-mail because a user code (%1$s) has been created for you on the Zenphoto gallery %2$s.'), $adm, $_zp_gallery->getTitle()) . "\n" . sprintf(gettext('To set your Zenphoto User password visit: %s'), FULLWEBPATH . "/" . ZENFOLDER . "/admin-users.php?ticket={$ref}&user={$adm}") . "\n" . gettext("This ticket will automatically expire in 3 days.");
         $err_msg = zp_mail(gettext("Zenphoto user created"), $msg, array($mail));
         if (!empty($err_msg)) {
             $savemsg .= $err_msg;
         }
     }
     return $savemsg;
 }
开发者ID:rb26,项目名称:zenphoto,代码行数:13,代码来源:email-newuser.php

示例3: emailReply

/**
 * Filters a new comment post and sends email replies to previous posters
 * @param object $comment the comment
 * @param object $owner the element commented upon.
 */
function emailReply($comment, $owner)
{
    $gallery = new Gallery();
    if ($comment->getInModeration() || $comment->getPrivate()) {
        return $comment;
        // we are not going to e-mail unless the comment has passed.
    }
    $oldcomments = $owner->comments;
    $emails = array();
    foreach ($oldcomments as $oldcomment) {
        $name = $oldcomment['name'];
        $emails[$name] = $oldcomment['email'];
    }
    $emails = array_unique($emails);
    switch ($comment->getType()) {
        case "albums":
            $url = "album=" . urlencode($owner->name);
            $action = sprintf(gettext('A reply has been posted on album "%1$s".'), $owner->name);
            break;
        case "news":
            $url = "p=" . ZENPAGE_NEWS . "&title=" . urlencode($owner->getTitlelink());
            $action = sprintf(gettext('A reply has been posted on article "%1$s".'), $owner->getTitlelink());
            break;
        case "pages":
            $url = "p=" . ZENPAGE_PAGES . "&title=" . urlencode($owner->getTitlelink());
            $action = sprintf(gettext('A reply has been posted on page "%1$s".'), $owner->getTitlelink());
            break;
        default:
            // all image types
            $url = "album=" . urlencode($owner->album->name) . "&image=" . urlencode($owner->filename);
            $action = sprintf(gettext('A reply has been posted on "%1$s" the album "%2$s".'), $owner->getTitle(), $owner->getAlbumName());
    }
    if ($comment->getAnon()) {
        $email = $name = '<' . gettext("Anonymous") . '>';
    } else {
        $name = $comment->getname();
        $email = $comment->getEmail();
    }
    $message = $action . "\n\n" . sprintf(gettext('Author: %1$s' . "\n" . 'Email: %2$s' . "\n" . 'Website: %3$s' . "\n" . 'Comment:' . "\n\n" . '%4$s'), $name, $email, $comment->getWebsite(), $comment->getComment()) . "\n\n" . sprintf(gettext('You can view all comments about this item here:' . "\n" . '%1$s'), 'http://' . $_SERVER['SERVER_NAME'] . WEBPATH . '/index.php?' . $url) . "\n\n";
    $on = gettext('Reply posted');
    zp_mail("[" . $gallery->getTitle() . "] {$on}", $message, $emails);
    return $comment;
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:48,代码来源:filter-comments.php

示例4: time

                            if ($newdate + getOption('user_expiry_interval') * 86400 < time()) {
                                $newdate = time() + getOption('user_expiry_interval') * 86400;
                            }
                            $userobj->setDateTime(date('Y-m-d H:i:s', $newdate));
                            $userobj->setValid(1);
                            $userobj->save();
                            break;
                        case 'revalidate':
                            $gallery = new Gallery();
                            $site = $gallery->getTitle();
                            $user_e = $userobj->getEmail();
                            $user = $userobj->getUser();
                            $key = bin2hex(serialize(array('user' => $user, 'email' => $user_e, 'date' => time())));
                            $link = FULLWEBPATH . '/index.php?user_expiry_reverify=' . $key;
                            $message = sprintf(gettext('Your %1$s credentials need to be renewed. Visit %2$s to renew your logon credentials.'), $site, $link);
                            $msg = zp_mail(sprintf(gettext('%s renewal required'), $site), $message, array($user => $user_e));
                            break;
                    }
                }
            }
        }
        header("Location: " . FULLWEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . '/user-expiry/user-expiry-tab.php?page=users&tab=groups&applied=' . $msg);
        exit;
    }
}
printAdminHeader('users');
echo '</head>' . "\n";
?>

<body>
	<?php 
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:31,代码来源:user-expiry-tab.php

示例5: checkexpires

 private static function checkexpires($loggedin, $userobj)
 {
     global $_zp_gallery;
     if ($userobj->logout_link !== true) {
         return $loggedin;
     }
     if (!($subscription = 86400 * getOption('user_expiry_interval'))) {
         // expiry is disabled
         return $loggedin;
     }
     $expires = strtotime($userobj->getDateTime()) + $subscription;
     if ($expires < time()) {
         $userobj->setValid(2);
         $userobj->save();
         $loggedin = false;
     } else {
         if ($expires < time() + getOption('user_expiry_warn_interval') * 86400) {
             //	expired
             if (getOption('user_expiry_auto_renew')) {
                 $newdate = getOption('user_expiry_interval') * 86400 + strtotime($userobj->getDateTime());
                 if ($newdate + getOption('user_expiry_interval') * 86400 < time()) {
                     $newdate = time() + getOption('user_expiry_interval') * 86400;
                 }
                 $userobj->setDateTime(date('Y-m-d H:i:s', $newdate));
                 $userobj->setValid(1);
                 $credentials = $userobj->getCredentials();
                 $key = array_search('exiry_notice', $credentials);
                 if ($key !== false) {
                     unset($credentials[$key]);
                     $userobj->setCredentials($credentials);
                 }
                 $userobj->save();
             } else {
                 if ($mail = $userobj->getEmail()) {
                     $credentials = $userobj->getCredentials();
                     if (!in_array('exiry_notice', $credentials)) {
                         $credentials[] = 'exiry_notice';
                         $userobj->setCredentials($credentials);
                         $userobj->save();
                         $message = sprintf(gettext('Your user id for the Zenphoto site %s will expire on %s.'), $_zp_gallery->getTitle(), date('Y-m-d', $expires));
                         $notify = zp_mail(get_language_string(gettext('User id expiration')), $message, array($userobj->getName() => $mail));
                     }
                 }
             }
         } else {
             $credentials = $userobj->getCredentials();
             $key = array_search('exiry_notice', $credentials);
             if ($key !== false) {
                 unset($credentials[$key]);
                 $userobj->setCredentials($credentials);
                 $userobj->save();
             }
         }
     }
     return $loggedin;
 }
开发者ID:Simounet,项目名称:zenphoto,代码行数:56,代码来源:user-expiry.php

示例6: switchLog

/**
 * Rolls a log over if it has grown too large.
 *
 * @param string $log
 */
function switchLog($log)
{
    $dir = getcwd();
    chdir(SERVERPATH . '/' . DATA_FOLDER);
    $list = safe_glob($log . '-*.log');
    if (empty($list)) {
        $counter = 1;
    } else {
        sort($list);
        $last = array_pop($list);
        preg_match('|' . $log . '-(.*).log|', $last, $matches);
        $counter = $matches[1] + 1;
    }
    chdir($dir);
    @copy(SERVERPATH . '/' . DATA_FOLDER . '/' . $log . '.log', SERVERPATH . '/' . DATA_FOLDER . '/' . $log . '-' . $counter . '.log');
    if (getOption($log . '_log_mail')) {
        zp_mail(sprintf(gettext('%s log size limit exceeded'), $log), sprintf(gettext('The %1$s log has exceeded its size limit and has been renamed to %2$s.'), $log, $log . '-' . $counter . '.log'));
    }
}
开发者ID:rb26,项目名称:zenphoto,代码行数:24,代码来源:functions-basic.php

示例7: printContactForm


//.........这里部分代码省略.........
" />
						<input type="hidden" id="message"	name="message" value="<?php 
                echo html_encode($message);
                ?>
" />
						<input type="hidden" id="mailaddress" name="mailaddress" value="<?php 
                echo html_encode($mailaddress);
                ?>
" />
						<input type="submit" value="<?php 
                echo gettext("Confirm");
                ?>
" />
					</form>
					<form id="discard" action="<?php 
                echo sanitize($_SERVER['REQUEST_URI']);
                ?>
" method="post" accept-charset="UTF-8">
						<input type="hidden" id="discard" name="discard" value="discard" />
						<input type="submit" value="<?php 
                echo gettext("Discard");
                ?>
" />
					</form>
				</div>
				<?php 
                return;
            } else {
                // simulate confirmation action
                $_POST['confirm'] = true;
                $_POST['subject'] = $subject;
                $_POST['message'] = $message;
                $_POST['mailaddress'] = $mailaddress;
                $_POST['name'] = $name;
            }
        }
    }
    if (isset($_POST['confirm'])) {
        $subject = sanitize($_POST['subject']);
        $message = sanitize($_POST['message'], 1);
        $mailaddress = sanitize($_POST['mailaddress']);
        $name = sanitize($_POST['name']);
        $contactform_mailinglist = getOption("contactform_mailaddress");
        $mailinglist = explode(';', $contactform_mailinglist);
        if (getOption('contactform_sendcopy')) {
            $sendcopy = array($name => $mailaddress);
        } else {
            $sendcopy = NULL;
        }
        $err_msg = zp_mail($subject, $message, $mailinglist, $sendcopy);
        if ($err_msg) {
            $msgs = explode('.', $err_msg);
            unset($msgs[0]);
            //	the "mail send failed" text
            unset($msgs[count($msgs)]);
            //	a trailing empty one
            ?>
			<div class="errorbox">
				<strong><?php 
            echo ngettext('Error sending mail:', 'Errors sending mail:', count($msgs));
            ?>
</strong>
				<ul class="errorlist">
					<?php 
            foreach ($msgs as $line) {
                echo '<li>' . trim($line) . '</li>';
            }
            ?>
				</ul>
			</div>
			<?php 
        } else {
            echo get_language_string(getOption("contactform_thankstext"));
        }
        echo '<p><a href="?again">' . get_language_string(getOption('contactform_newmessagelink')) . '</a></p>';
    } else {
        if (count($error) <= 0) {
            if (zp_loggedin()) {
                $mailcontent = array('title' => '', 'name' => $_zp_current_admin_obj->getName(), 'company' => '', 'street' => '', 'city' => '', 'state' => '', 'country' => '', 'postal' => '', 'email' => $_zp_current_admin_obj->getEmail(), 'website' => '', 'phone' => '', 'subject' => $subject_override, 'message' => '');
                if (getOption('zp_plugin_comment_form')) {
                    $raw = $_zp_current_admin_obj->getCustomData();
                    if (preg_match('/^a:[0-9]+:{/', $raw)) {
                        $address = unserialize($raw);
                        foreach ($address as $key => $field) {
                            $mailcontent[$key] = $field;
                        }
                    }
                }
            } else {
                $mailcontent = array('title' => '', 'name' => '', 'company' => '', 'street' => '', 'city' => '', 'state' => '', 'country' => '', 'email' => '', 'postal' => '', 'website' => '', 'phone' => '', 'subject' => $subject_override, 'message' => '');
            }
        }
        echo get_language_string(getOption("contactform_introtext"));
        if (getOption('contactform_sendcopy')) {
            echo get_language_string(getOption("contactform_sendcopy_text"));
        }
        $_processing_post = false;
        include getPlugin('contact_form/form.php', true);
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:101,代码来源:contact_form.php

示例8: getAdministrators

 // handle form post
 if (isset($_GET['verify'])) {
     $currentadmins = getAdministrators();
     $params = unserialize(pack("H*", $_GET['verify']));
     $adminuser = NULL;
     foreach ($currentadmins as $admin) {
         if ($admin['user'] == $params['user'] && $admin['email'] == $params['email']) {
             $adminuser = $admin;
             break;
         }
     }
     if (!is_null($adminuser)) {
         $rights = getOption('register_user_rights');
         saveAdmin($adminuser['user'], NULL, $admin_n = $adminuser['name'], $admin_e = $adminuser['email'], $rights, NULL);
         if (getOption('register_user_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.'), $admin_n, $adminuser['user'], $admin_e));
         }
         $notify = 'verified';
     } else {
         $notify = 'not_verified';
     }
 }
 if (isset($_POST['register_user'])) {
     $pass = trim($_POST['adminpass']);
     $user = trim($_POST['adminuser']);
     $admin_n = trim($_POST['admin_name']);
     $admin_e = trim($_POST['admin_email']);
     if (!empty($user) && !empty($admin_n) && !empty($admin_e)) {
         if ($pass == trim($_POST['adminpass_2'])) {
             if (empty($pass)) {
                 $pwd = null;
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:31,代码来源:register_user.php

示例9: handleLogon

 /**
  * User authentication support
  */
 function handleLogon()
 {
     global $_zp_current_admin_obj, $_zp_login_error, $_zp_captcha, $_zp_loggedin;
     if (isset($_POST['login'])) {
         $post_user = sanitize(@$_POST['user'], 0);
         $post_pass = sanitize(@$_POST['pass'], 0);
         $_zp_loggedin = false;
         switch (@$_POST['password']) {
             default:
                 $user = self::checkLogon($post_user, $post_pass);
                 if ($user) {
                     $_zp_loggedin = $user->getRights();
                 }
                 $_zp_loggedin = zp_apply_filter('admin_login_attempt', $_zp_loggedin, $post_user, $post_pass);
                 if ($_zp_loggedin) {
                     self::logUser($user);
                     $_zp_current_admin_obj = $user;
                     session_regenerate_id(true);
                 } else {
                     zp_clearCookie("zp_user_auth");
                     // Clear the cookie, just in case
                     $_zp_login_error = 1;
                 }
                 break;
             case 'challenge':
                 $user = $this->getAnAdmin(array('`user`=' => $post_user, '`valid`=' => 1));
                 if (is_object($user)) {
                     $info = $user->getChallengePhraseInfo();
                     if ($post_pass && $info['response'] == $post_pass) {
                         $ref = self::getResetTicket($post_user, $user->getPass());
                         header('location:' . WEBPATH . '/' . ZENFOLDER . '/admin-users.php?ticket=' . $ref . '&user=' . $post_user);
                         exitZP();
                     }
                 }
                 $_zp_login_error = gettext('Sorry, that is not the answer.');
                 $_REQUEST['logon_step'] = 'challenge';
                 break;
             case 'captcha':
                 if ($_zp_captcha->checkCaptcha(trim(@$_POST['code']), sanitize(@$_POST['code_h'], 3))) {
                     require_once dirname(__FILE__) . '/load_objectClasses.php';
                     // be sure that the plugins are loaded for the mail handler
                     if (empty($post_user)) {
                         $requestor = gettext('You are receiving this e-mail because of a password reset request on your ZenPhoto20 gallery.');
                     } else {
                         $requestor = sprintf(gettext("You are receiving this e-mail because of a password reset request on your ZenPhoto20 gallery from a user who tried to log in as %s."), $post_user);
                     }
                     $admins = $this->getAdministrators();
                     $mails = array();
                     $user = NULL;
                     foreach ($admins as $key => $tuser) {
                         if (!empty($tuser['email'])) {
                             if (!empty($post_user) && ($tuser['user'] == $post_user || $tuser['email'] == $post_user)) {
                                 $name = $tuser['name'];
                                 if (empty($name)) {
                                     $name = $tuser['user'];
                                 }
                                 $mails[$name] = $tuser['email'];
                                 $user = $tuser;
                                 unset($admins[$key]);
                                 // drop him from alternate list.
                             } else {
                                 if (!($tuser['rights'] & ADMIN_RIGHTS)) {
                                     unset($admins[$key]);
                                     // eliminate any peons from the list
                                 }
                             }
                         } else {
                             unset($admins[$key]);
                             // we want to ignore groups and users with no email address here!
                         }
                     }
                     $cclist = array();
                     foreach ($admins as $tuser) {
                         $name = $tuser['name'];
                         if (empty($name)) {
                             $name = $tuser['user'];
                         }
                         if (is_null($user)) {
                             $user = $tuser;
                             $mails[$name] = $tuser['email'];
                         } else {
                             $cclist[$name] = $tuser['email'];
                         }
                     }
                     if (is_null($user)) {
                         $_zp_login_error = gettext('There was no one to which to send the reset request.');
                     } else {
                         $ref = self::getResetTicket($user['user'], $user['pass']);
                         $msg = "\n" . $requestor . "\n" . sprintf(gettext("To reset your Admin passwords visit: %s"), FULLWEBPATH . "/" . ZENFOLDER . "/admin-users.php?ticket={$ref}&user=" . $user['user']) . "\n" . gettext("If you do not wish to reset your passwords just ignore this message. This ticket will automatically expire in 3 days.");
                         $err_msg = zp_mail(gettext("The ZenPhoto20 information you requested"), $msg, $mails, $cclist);
                         if (empty($err_msg)) {
                             $_zp_login_error = 2;
                         } else {
                             $_zp_login_error = $err_msg;
                         }
                     }
                 } else {
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:lib-auth.php

示例10: comment_form_addComment


//.........这里部分代码省略.........
                $_zp_comment_on_hold = sprintf(gettext('Your comment has been marked for moderation by the <em>%s</em> SPAM filter.'), $_zp_spamFilter->name);
                $commentobj->comment_error_text .= $_zp_comment_on_hold;
                $commentobj->setInModeration(1);
                $moderate = 1;
                break;
            case 2:
                $commentobj->setInModeration(0);
                break;
        }
    }
    $localerrors = $commentobj->getInModeration();
    zp_apply_filter('comment_post', $commentobj, $receiver);
    if ($check === false) {
        // ignore filter provided errors if caller is supplying the fields to check
        $localerrors = $commentobj->getInModeration();
    }
    if ($goodMessage && $localerrors >= 0) {
        // Update the database entry with the new comment
        $commentobj->save();
        //  add to comments array and notify the admin user
        if (!$moderate) {
            $receiver->comments[] = array('name' => $commentobj->getname(), 'email' => $commentobj->getEmail(), 'website' => $commentobj->getWebsite(), 'comment' => $commentobj->getComment(), 'date' => $commentobj->getDateTime(), 'custom_data' => $commentobj->getCustomData());
        }
        switch ($type) {
            case "albums":
                $url = "album=" . pathurlencode($receiver->name);
                $ur_album = getUrAlbum($receiver);
                if ($moderate) {
                    $action = sprintf(gettext('A comment has been placed in moderation on your album “%1$s”.'), $receiver->name);
                } else {
                    $action = sprintf(gettext('A comment has been posted on your album “%1$s”.'), $receiver->name);
                }
                break;
            case "news":
                $url = "p=news&title=" . urlencode($receiver->getTitlelink());
                if ($moderate) {
                    $action = sprintf(gettext('A comment has been placed in moderation on your article “%1$s”.'), $receiver->getTitlelink());
                } else {
                    $action = sprintf(gettext('A comment has been posted on your article “%1$s”.'), $receiver->getTitlelink());
                }
                break;
            case "pages":
                $url = "p=pages&title=" . urlencode($receiver->getTitlelink());
                if ($moderate) {
                    $action = sprintf(gettext('A comment has been placed in moderation on your page “%1$s”.'), $receiver->getTitlelink());
                } else {
                    $action = sprintf(gettext('A comment has been posted on your page “%1$s”.'), $receiver->getTitlelink());
                }
                break;
            default:
                // all image types
                $album = $receiver->getAlbum();
                $url = "album=" . pathurlencode($album->name) . "&image=" . urlencode($receiver->filename);
                $ur_album = getUrAlbum($album);
                if ($moderate) {
                    $action = sprintf(gettext('A comment has been placed in moderation on your image “%1$s” in the album “%2$s”.'), $receiver->getTitle(), $album->name);
                } else {
                    $action = sprintf(gettext('A comment has been posted on your image “%1$s” in the album “%2$s”.'), $receiver->getTitle(), $album->name);
                }
                break;
        }
        if ($whattocheck & COMMENT_SEND_EMAIL) {
            $message = $action . "\n\n" . sprintf(gettext('Author: %1$s' . "\n" . 'Email: %2$s' . "\n" . 'Website: %3$s' . "\n" . 'Comment:' . "\n\n" . '%4$s'), $commentobj->getname(), $commentobj->getEmail(), $commentobj->getWebsite(), $commentobj->getComment()) . "\n\n" . sprintf(gettext('You can view all comments about this item here:' . "\n" . '%1$s'), 'http://' . $_SERVER['SERVER_NAME'] . WEBPATH . '/index.php?' . $url) . "\n\n" . sprintf(gettext('You can edit the comment here:' . "\n" . '%1$s'), 'http://' . $_SERVER['SERVER_NAME'] . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/comment_form/admin-comments.php?page=editcomment&id=' . $commentobj->getID());
            $emails = array();
            $admin_users = $_zp_authority->getAdministrators();
            foreach ($admin_users as $admin) {
                // mail anyone with full rights
                if (!empty($admin['email']) && ($admin['rights'] & ADMIN_RIGHTS || ($admin['rights'] & (MANAGE_ALL_ALBUM_RIGHTS | COMMENT_RIGHTS)) == (MANAGE_ALL_ALBUM_RIGHTS | COMMENT_RIGHTS))) {
                    $emails[] = $admin['email'];
                    unset($admin_users[$admin['id']]);
                }
            }
            if ($type === "images" or $type === "albums") {
                // mail to album admins
                $id = $ur_album->getID();
                $sql = 'SELECT `adminid` FROM ' . prefix('admin_to_object') . ' WHERE `objectid`=' . $id . ' AND `type` LIKE "album%"';
                $result = query($sql);
                if ($result) {
                    while ($anadmin = db_fetch_assoc($result)) {
                        $id = $anadmin['adminid'];
                        if (array_key_exists($id, $admin_users)) {
                            $admin = $admin_users[$id];
                            if ($admin['rights'] & COMMENT_RIGHTS && !empty($admin['email'])) {
                                $emails[] = $admin['email'];
                            }
                        }
                    }
                    db_free_result($result);
                }
            }
            $on = gettext('Comment posted');
            $result = zp_mail("[" . $_zp_gallery->getTitle() . "] {$on}", $message, $emails);
            if ($result) {
                $commentobj->setInModeration(-12);
                $commentobj->comment_error_text = $result;
            }
        }
    }
    return $commentobj;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:functions.php

示例11: handleLogon

 /**
  * User authentication support
  */
 function handleLogon()
 {
     global $_zp_authority, $_zp_current_admin_obj, $_zp_login_error, $_zp_captcha, $_zp_loggedin;
     if (isset($_POST['login']) && isset($_POST['user']) && isset($_POST['pass'])) {
         $post_user = sanitize($_POST['user']);
         $post_pass = sanitize($_POST['pass'], 0);
         $user = $this->checkLogon($post_user, $post_pass, true);
         if ($user) {
             $_zp_loggedin = $user->getRights();
         } else {
             $_zp_loggedin = false;
         }
         $_zp_loggedin = zp_apply_filter('admin_login_attempt', $_zp_loggedin, $post_user, $post_pass);
         if ($_zp_loggedin) {
             $this->logUser($user);
         } else {
             // Clear the cookie, just in case
             zp_setCookie("zenphoto_auth", "", -368000);
             // was it a request for a reset?
             if (isset($_POST['code_h']) && $_zp_captcha->checkCaptcha(trim($post_pass), sanitize($_POST['code_h'], 3))) {
                 require_once dirname(__FILE__) . '/class-load.php';
                 // be sure that the plugins are loaded for the mail handler
                 if (empty($post_user)) {
                     $requestor = gettext('You are receiving this e-mail because of a password reset request on your Zenphoto gallery.');
                 } else {
                     $requestor = sprintf(gettext("You are receiving this e-mail because of a password reset request on your Zenphoto gallery from a user who tried to log in as %s."), $post_user);
                 }
                 $admins = $_zp_authority->getAdministrators();
                 $mails = array();
                 $user = NULL;
                 foreach ($admins as $key => $tuser) {
                     if (!empty($tuser['email'])) {
                         if (!empty($post_user) && ($tuser['user'] == $post_user || $tuser['email'] == $post_user)) {
                             $name = $tuser['name'];
                             if (empty($name)) {
                                 $name = $tuser['user'];
                             }
                             $mails[$name] = $tuser['email'];
                             $user = $tuser;
                             unset($admins[$key]);
                             // drop him from alternate list.
                         } else {
                             if (!($tuser['rights'] & ADMIN_RIGHTS)) {
                                 unset($admins[$key]);
                                 // eliminate any peons from the list
                             }
                         }
                     } else {
                         unset($admins[$key]);
                         // we want to ignore groups and users with no email address here!
                     }
                 }
                 $cclist = array();
                 foreach ($admins as $tuser) {
                     $name = $tuser['name'];
                     if (empty($name)) {
                         $name = $tuser['user'];
                     }
                     if (is_null($user)) {
                         $user = $tuser;
                         $mails[$name] = $tuser['email'];
                     } else {
                         $cclist[$name] = $tuser['email'];
                     }
                 }
                 if (is_null($user)) {
                     $_zp_login_error = gettext('There was no one to which to send the reset request.');
                 } else {
                     $ref = $this->getResetTicket($user['user'], $user['pass']);
                     $msg = "\n" . $requestor . "\n" . sprintf(gettext("To reset your Zenphoto Admin passwords visit: %s"), FULLWEBPATH . "/" . ZENFOLDER . "/admin-users.php?ticket={$ref}&user=" . $user['user']) . "\n" . gettext("If you do not wish to reset your passwords just ignore this message. This ticket will automatically expire in 3 days.");
                     $err_msg = zp_mail(gettext("The Zenphoto information you requested"), $msg, $mails, $cclist);
                     if (empty($err_msg)) {
                         $_zp_login_error = 2;
                     } else {
                         $_zp_login_error = $err_msg;
                     }
                 }
             } else {
                 $_zp_login_error = 1;
             }
         }
     }
     return $_zp_loggedin;
 }
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:87,代码来源:lib-auth.php

示例12: post_processor


//.........这里部分代码省略.........
         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['user'], 0));
     }
     if (!is_valid_email_zp($admin_e)) {
         $_notify = 'invalidemail';
     }
     $pass = trim(sanitize($_POST['pass'], 0));
     $user = trim(sanitize($_POST['user'], 0));
     if (empty($pass)) {
         $_notify = 'empty';
     } else {
         if (!empty($user) && !empty($admin_n) && !empty($admin_e)) {
             if (isset($_POST['disclose_password']) || $pass == trim(sanitize($_POST['pass_r']))) {
                 $currentadmin = $_zp_authority->getAnAdmin(array('`user`=' => $user, '`valid`>' => 0));
                 if (is_object($currentadmin)) {
                     $_notify = 'exists';
                 } else {
                     if ($_zp_authority->getAnAdmin(array('`email`=' => $admin_e, '`valid`=' => '1'))) {
                         $_notify = 'dup_email';
                     }
                 }
                 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());
                     if (extensionEnabled('userAddressFields')) {
                         $addresses = getOption('register_user_address_info');
                         $userinfo = register_user::getUserInfo(0);
                         $_comment_form_save_post = serialize($userinfo);
                         if ($addresses == 'required') {
                             if (!isset($userinfo['street']) || empty($userinfo['street'])) {
                                 $userobj->transient = true;
                                 $userobj->msg .= ' ' . gettext('You must supply the street field.');
                             }
                             if (!isset($userinfo['city']) || empty($userinfo['city'])) {
                                 $userobj->transient = true;
                                 $userobj->msg .= ' ' . gettext('You must supply the city field.');
                             }
                             if (!isset($userinfo['state']) || empty($userinfo['state'])) {
                                 $userobj->transient = true;
                                 $userobj->msg .= ' ' . gettext('You must supply the state field.');
                             }
                             if (!isset($userinfo['country']) || empty($userinfo['country'])) {
                                 $userobj->transient = true;
                                 $userobj->msg .= ' ' . gettext('You must supply the country field.');
                             }
                             if (!isset($userinfo['postal']) || empty($userinfo['postal'])) {
                                 $userobj->transient = true;
                                 $userobj->msg .= ' ' . gettext('You must supply the postal code field.');
                             }
                         }
                         zp_setCookie('reister_user_form_addresses', $_comment_form_save_post);
                         userAddressFields::setCustomData($userobj, $userinfo);
                     }
                     zp_apply_filter('register_user_registered', $userobj);
                     if ($userobj->transient) {
                         if (empty($_notify)) {
                             $_notify = 'filter';
                         }
                     } else {
                         $userobj->save();
                         if (MOD_REWRITE) {
                             $verify = '?verify=';
                         } else {
                             $verify = '&verify=';
                         }
                         $_link = PROTOCOL . "://" . $_SERVER['HTTP_HOST'] . register_user::getLink() . $verify . bin2hex(serialize(array('user' => $user, 'email' => $admin_e)));
                         $_message = sprintf(get_language_string(getOption('register_user_text')), $_link, $admin_n, $user, $pass);
                         $_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';
         }
     }
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:register_user.php

示例13: sprintf

            // was it a request for a reset?
            if ($_zp_captcha->checkCaptcha(trim($post_pass), sanitize($_POST['code_h'], 3))) {
                if (empty($post_user)) {
                    $requestor = 'You are receiving this e-mail because of a password reset request on your Zenphoto gallery.';
                } else {
                    $requestor = sprintf(gettext("You are receiving this e-mail because of a password reset request on your Zenphoto gallery from a user who tried to log in as %s."), $post_user);
                }
                $admins = getAdministrators();
                $user = array_shift($admins);
                $adm = $user['user'];
                $pas = $user['pass'];
                setOption('admin_reset_date', time());
                $req = getOption('admin_reset_date');
                $ref = md5($req . $adm . $pas);
                $msg = "\n" . $requestor . "\n" . sprintf(gettext("To reset your Zenphoto Admin passwords visit: %s"), FULLWEBPATH . "/" . ZENFOLDER . "/admin-options.php?ticket={$ref}") . "\n" . gettext("If you do not wish to reset your passwords just ignore this message. This ticket will automatically expire in 3 days.");
                zp_mail(gettext("The Zenphoto information you requested"), $msg);
                $_zp_login_error = 2;
            } else {
                $_zp_login_error = 1;
            }
        }
    }
}
unset($saved_auth, $check_auth, $user, $pass);
// Handle a logout action.
if (isset($_REQUEST['logout'])) {
    zp_setcookie("zenphoto_auth", "*", time() - 368000, $cookiepath);
    $redirect = 'index.php';
    if (isset($_GET['p'])) {
        $redirect .= "?p=" . $_GET['p'];
        if (isset($_GET['searchfields'])) {
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:31,代码来源:auth_zp.php

示例14: printRegistrationForm

/**
 * 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);
//.........这里部分代码省略.........
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:101,代码来源:register_user.php

示例15: verify

 /**
  * Processes the verification POST tickets
  * @param string $script (we do not use this)
  * @return string
  */
 static function verify($script)
 {
     //process any verifications posted
     if (isset($_GET['verify_federated_user'])) {
         $params = unserialize(pack("H*", trim(sanitize($_GET['verify_federated_user']), '.')));
         if (time() - $params['date'] < 2592000) {
             $userobj = Zenphoto_Authority::getAnAdmin(array('`user`=' => $params['user'], '`email`=' => $params['email'], '`valid`>' => 0));
             if ($userobj) {
                 $groupname = getOption('federated_login_group');
                 $groupobj = Zenphoto_Authority::getAnAdmin(array('`user`=' => $groupname, '`valid`=' => 0));
                 if ($groupobj) {
                     $userobj->setRights($groupobj->getRights());
                     $userobj->setGroup($groupname);
                     $userobj->setObjects($groupobj->getObjects());
                     if (getOption('register_user_create_album')) {
                         $userobj->createPrimealbum();
                     }
                     $userobj->save();
                 }
                 zp_apply_filter('register_user_verified', $userobj);
                 if (getOption('register_logon_user_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()));
                 }
                 Zenphoto_Authority::logUser($userobj);
                 header("Location: " . FULLWEBPATH . '/' . ZENFOLDER . '/admin.php');
                 exitZP();
             }
         }
     }
     return $script;
 }
开发者ID:rb26,项目名称:zenphoto,代码行数:36,代码来源:federated_logon.php


注:本文中的zp_mail函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。