示例#1
0
/**
 * Returns a link to the "comment user"/"registered visitor" page
 * (with the correct weblog selection). 
 *
 * It takes three (optional) smarty parameters - 'weblog', 
 * 'linktext' and 'linktext_logged_in'.
 *
 * @param array $params
 * @return string
 */
function smarty_register_as_visitor_link($params)
{
    global $PIVOTX;
    $weblog = getDefault($params['weblog'], $PIVOTX['weblogs']->getCurrent());
    $url = makeVisitorPageLink('', $weblog);
    require_once $PIVOTX['paths']['pivotx_path'] . 'modules/module_userreg.php';
    $visitors = new Visitors();
    if ($visitors->isLoggedIn()) {
        $linktext = getDefault($params['linktext_logged_in'], __('account'));
    } else {
        $linktext = getDefault($params['linktext'], __('register/login'));
    }
    return "<a href='{$url}' class='pivotx-system-links'>{$linktext}</a>";
}
示例#2
0
 function regUser($user)
 {
     global $PIVOTX;
     $name_md5 = strtolower(md5(strtolower($user['name'])));
     if (saveSerialize($PIVOTX['paths']['db_path'] . 'users/' . $name_md5 . '.php', $user)) {
         $text = sprintf("<h2>%s</h2>\n\n", __('User stored!'));
     } else {
         $text = sprintf("<h2>%s</h2>\n\n", __('Could not store new user!!'));
     }
     $mail1 = __("You have registered as a user on PivotX \"%s\" \n\n");
     $mail2 = __("To verify your account, click the following link:\n%s\n\n");
     $url = sprintf("%s&amp;name=%s&amp;code=%s", $PIVOTX['paths']['host'] . makeVisitorPageLink('verify'), urlencode($user['name']), md5($user['pass'] . "email"));
     $mail = sprintf($mail1 . $mail2, $PIVOTX['config']->get('sitename'), str_replace('&amp;', '&', $url));
     if (!pivotxMail($user['email'], __('Registration confirmation'), $mail)) {
         $mail2 = '<a href="%s">' . __('Verify your account') . '</a>';
         $mail = sprintf($mail1 . $mail2, $PIVOTX['config']->get('sitename'), $url);
         $text = "\n<br />" . nl2br($mail) . "<br />\n";
     } else {
         $text = sprintf(__('Mail verification sent to %s. ' . 'Please check your email in a minute to confirm your account.'), $user['email']);
     }
     $this->input['message'] = $text;
     sendMailNotification('visitor_registration', array('add', $user['name']));
 }