/** * @author Matthew McNaney * @version $Id$ */ function new_account($item) { if (!PHPWS_User::getUserSetting('new_user_method') > 0) { $msg = dgettext('users', 'New user signup is currently disabled.'); return $msg; } $signup_vars = array('action' => 'user', 'command' => 'signup_user'); if (!empty($item[1])) { $link = strip_tags($item[1]); } else { $link = USER_SIGNUP_QUESTION; } return PHPWS_Text::moduleLink($link, 'users', $signup_vars); }
public function __construct($id = 0, $username = null) { if ($id) { $this->setId($id); } else { if ($username) { $this->setUsername($username); } else { $this->authorize = PHPWS_User::getUserSetting('default_authorization'); $this->loadScript(); return; } } $result = $this->init(); PHPWS_Error::logIfError($result); if ($result) { $this->loadScript(); } }
/** * Sends email to Wiki Admin if option enabled * * @author Greg Meiste <*****@*****.**> */ function sendEmail() { if (PHPWS_Settings::get('wiki', 'monitor_edits')) { $pagetitle = WikiManager::formatTitle(strip_tags($_REQUEST['page'])); $message = PHPWS_Settings::get('wiki', 'email_text'); $message = str_replace('[page]', $pagetitle, $message); $message = str_replace('[url]', PHPWS_Core::getHomeHttp() . (MOD_REWRITE_ENABLED ? 'wiki/' : 'index.php?module=wiki&page=') . $_REQUEST['page'], $message); PHPWS_Core::initCoreClass('Mail.php'); $mail = new PHPWS_Mail(); $mail->addSendTo(PHPWS_Settings::get('wiki', 'admin_email')); $mail->setSubject(sprintf(dgettext('wiki', '%s updated!'), $pagetitle)); $mail->setFrom(PHPWS_User::getUserSetting('site_contact')); $mail->setMessageBody($message); $mail->send(); } }
/** * Signup form for new users */ public static function signup_form($user, $message = NULL) { $form = new PHPWS_Form(); $form->addHidden('module', 'users'); $form->addHidden('action', 'user'); $form->addHidden('command', 'submit_new_user'); $form->addText('username', $user->getUsername()); $form->setLabel('username', dgettext('users', 'Username')); $new_user_method = PHPWS_User::getUserSetting('new_user_method'); $form->addPassword('password1', $user->getPassword()); $form->allowValue('password1'); $form->setLabel('password1', dgettext('users', 'Password')); $form->addPassword('password2', $user->getPassword()); $form->allowValue('password2'); $form->setLabel('password2', dgettext('users', 'Confirm')); $form->addText('email', $user->getEmail()); $form->setLabel('email', dgettext('users', 'Email Address')); $form->setSize('email', 40); if (PHPWS_User::getUserSetting('graphic_confirm')) { $result = User_Form::confirmGraphic(); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); } else { $form->addTplTag('GRAPHIC', $result); } } $form->addSubmit('submit', dgettext('users', 'Sign up')); $template = $form->getTemplate(); if (isset($message)) { foreach ($message as $tag => $error) { $template[$tag] = $error; } } $result = PHPWS_Template::process($template, 'users', 'forms/signup_form.tpl'); return $result; }
<?php /** * Wiki for phpWebSite * * See docs/CREDITS for copyright information * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @package Wiki * @author Greg Meiste <*****@*****.**> */ $settings = array('show_on_home' => 1, 'allow_anon_view' => 1, 'allow_page_edit' => 0, 'allow_image_upload' => 0, 'allow_bbcode' => 0, 'ext_chars_support' => 0, 'add_to_title' => 1, 'format_title' => 0, 'show_modified_info' => 1, 'diff_type' => 'two_col', 'monitor_edits' => 0, 'admin_email' => PHPWS_User::getUserSetting('site_contact'), 'email_text' => '[page] has been updated. Go to [url] to view it.', 'default_page' => 'FrontPage', 'ext_page_target' => '_blank', 'immutable_page' => 1, 'raw_text' => 0, 'print_view' => 1, 'what_links_here' => 1, 'recent_changes' => 1, 'random_page' => 1, 'discussion' => 1, 'discussion_anon' => 0);
public static function notifyUser($user, $password) { PHPWS_Core::initCoreClass('Mail.php'); $page_title = Layout::getPageTitle(true); $body[] = sprintf(dgettext('users', '%s created an user account for you.'), $page_title); $body[] = dgettext('users', 'You may log-in using the following information:'); $body[] = sprintf(dgettext('users', 'Site address: %s'), PHPWS_Core::getHomeHttp()); $body[] = sprintf(dgettext('users', 'Username: %s'), $user->username); $body[] = sprintf(dgettext('users', 'Password: %s'), $password); $body[] = dgettext('users', 'Please change your password immediately after logging in.'); $mail = new PHPWS_Mail(); $mail->addSendTo($user->email); $mail->setSubject(sprintf(dgettext('users', '%s account created'), $page_title)); $mail->setFrom(PHPWS_User::getUserSetting('site_contact')); $mail->setReplyTo(PHPWS_User::getUserSetting('site_contact')); $mail->setMessageBody(implode("\n\n", $body)); $result = $mail->send(); return $result; }