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


PHP JUser::getProperties方法代码示例

本文整理汇总了PHP中JUser::getProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP JUser::getProperties方法的具体用法?PHP JUser::getProperties怎么用?PHP JUser::getProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JUser的用法示例。


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

示例1: createUser

 function createUser($username)
 {
     $new_user = new JUser();
     $this->db->setQuery("SELECT email, isAdm FROM #__user WHERE name = " . $this->db->Quote($username));
     $r = $this->db->loadRow();
     $email = $r[0];
     $isAdm = $r[1];
     jimport('joomla.application.component.helper');
     $config =& JComponentHelper::getParams('com_users');
     if ($isAdm) {
         $usertype = 'Super Administrator';
     } else {
         $usertype = $config->get('new_usertype', 'Registered');
     }
     $acl =& JFactory::getACL();
     $new_user->set('id', 0);
     $new_user->set('name', $username);
     $new_user->set('username', $username);
     $new_user->set('email', $email);
     $new_user->set('gid', $acl->get_group_id('', $usertype));
     $new_user->set('usertype', $usertype);
     $new_user->set('registeredDate', date('Y-m-d H:i:s'));
     $new_user->set('lastVisitDate', date('Y-m-d H:i:s'));
     $table =& $new_user->getTable();
     $new_user->params = $new_user->_params->toString();
     $table->bind($new_user->getProperties());
     //			$new_user->save();
     if ($table->store()) {
         return $table->get('id');
     }
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:31,代码来源:noah.php

示例2: getProperties

 /**
  * Returns an associative array of Cms User properties that can be accessed with get().
  *
  * @return array
  */
 public function getProperties()
 {
     static $properties = null;
     if ($properties == null) {
         $properties = $this->cmsOwnUser->getProperties();
     }
     return $properties;
 }
开发者ID:Raul-mz,项目名称:web-erpcya,代码行数:13,代码来源:CmsUser.php

示例3: register

 /**
  * 
  * function register()
  * @param array() $temp
  */
 public static function register($temp)
 {
     $config = JFactory::getConfig();
     $db = JFactory::getDbo();
     $params = JComponentHelper::getParams('com_users');
     // Initialise the table with JUser.
     $user = new JUser();
     // Merge in the registration data.
     foreach ($temp as $k => $v) {
         $data[$k] = $v;
     }
     // Prepare the data for the user object.
     $data['email'] = $data['email1'];
     $data['password'] = $data['password1'];
     $useractivation = $params->get('useractivation');
     // Check if the user needs to activate their account.
     if ($useractivation == 1 || $useractivation == 2) {
         $data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
         $data['block'] = 1;
     }
     $system = $params->get('new_usertype', 2);
     $data['groups'] = array($system);
     // Bind the data.
     if (!$user->bind($data)) {
         self::ajaxResponse('$error$' . JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
     }
     // Load the users plugin group.
     JPluginHelper::importPlugin('user');
     // Store the data.
     if (!$user->save()) {
         self::ajaxResponse('$error$' . JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
     }
     // Compile the notification mail values.
     $data = $user->getProperties();
     $data['fromname'] = $config->get('fromname');
     $data['mailfrom'] = $config->get('mailfrom');
     $data['sitename'] = $config->get('sitename');
     $data['siteurl'] = str_replace('modules/mod_bt_login/', '', JURI::root());
     // Handle account activation/confirmation emails.
     if ($useractivation == 2) {
         // Set the link to confirm the user email.
         $data['activate'] = $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'];
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'], $data['password_clear']);
     } elseif ($useractivation == 1) {
         // Set the link to activate the user account.
         $data['activate'] = $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'];
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'], $data['password_clear']);
     } else {
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_BODY', $data['name'], $data['sitename'], $data['siteurl']);
     }
     // Send the registration email.
     $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
     //Send Notification mail to administrators
     if ($params->get('useractivation') < 2 && $params->get('mail_to_admin') == 1) {
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_REGISTERED_BODY', $data['name'], $data['sitename']);
         $emailBodyAdmin = JText::sprintf('COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY', $data['name'], $data['username'], $data['siteurl']);
         // get all admin users
         $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE sendEmail=1';
         $db->setQuery($query);
         $rows = $db->loadObjectList();
         // Send mail to all superadministrators id
         foreach ($rows as $row) {
             JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $row->email, $emailSubject, $emailBodyAdmin);
             // Check for an error.
             if ($return !== true) {
                 //echo(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED'));
             }
         }
     }
     // Check for an error.
     if ($return !== true) {
         //echo (JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED'));
         // Send a system message to administrators receiving system mails
         $db = JFactory::getDBO();
         $q = "SELECT id\n\t\t\t\tFROM #__users\n\t\t\t\tWHERE block = 0\n\t\t\t\tAND sendEmail = 1";
         $db->setQuery($q);
         $sendEmail = $db->loadColumn();
         if (count($sendEmail) > 0) {
             $jdate = new JDate();
             // Build the query to add the messages
             $q = "INSERT INTO " . $db->quoteName('#__messages') . " (" . $db->quoteName('user_id_from') . ", " . $db->quoteName('user_id_to') . ", " . $db->quoteName('date_time') . ", " . $db->quoteName('subject') . ", " . $db->quoteName('message') . ") VALUES ";
             $messages = array();
             foreach ($sendEmail as $userid) {
                 $messages[] = "(" . $userid . ", " . $userid . ", '" . $jdate->toSql() . "', '" . JText::_('COM_USERS_MAIL_SEND_FAILURE_SUBJECT') . "', '" . JText::sprintf('COM_USERS_MAIL_SEND_FAILURE_BODY', $return, $data['username']) . "')";
             }
             $q .= implode(',', $messages);
             $db->setQuery($q);
             $db->query();
         }
     }
     if ($useractivation == 1) {
         return "useractivate";
//.........这里部分代码省略.........
开发者ID:vstorm83,项目名称:propertease,代码行数:101,代码来源:helper.php

示例4: register

 /**
  * Method to save the form data.
  *
  * @param	array		The form data.
  * @return	mixed		The user id on success, false on failure.
  * @since	1.6
  */
 public function register($temp)
 {
     $config = JFactory::getConfig();
     $db = $this->getDbo();
     $params = JComponentHelper::getParams('com_cvnusers');
     // Initialise the table with JUser.
     $user = new JUser();
     $data = (array) $this->getData();
     // Merge in the registration data.
     foreach ($temp as $k => $v) {
         $data[$k] = $v;
     }
     // Prepare the data for the user object.
     $data['email'] = $data['email1'];
     $data['password'] = $data['password1'];
     $useractivation = $params->get('useractivation');
     $sendpassword = $params->get('sendpassword', 1);
     // Check if the user needs to activate their account.
     if ($useractivation == 1 || $useractivation == 2) {
         $data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
         $data['block'] = 1;
     }
     //Set name from username (register require only username in chessvn)
     $data['name'] = $data['username'];
     // Bind the data.
     if (!$user->bind($data)) {
         $this->setError(JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
         return false;
     }
     // Load the users plugin group.
     JPluginHelper::importPlugin('user');
     // Store the data.
     if (!$user->save()) {
         $this->setError(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
         return false;
     }
     //Save additional data for player (user of chessvn)
     // Trong đây là add thêm các cột userid lấy từ bảng user, coin là tạo = 10000000;
     JLog::add(JText::_('khanglq:--- begin go here to Save additional data for player '), JLog::INFO);
     global $newUserCoin, $defaultAvatar, $chessTypeChess, $ratingTypeStandard, $initELO;
     // Phan tao folder va copy file
     $registerDate = JFactory::getDate();
     $mediaplayer = '/mediaplayer/' . $registerDate->format('Y/Ym/Ymd/') . $user->id . '_' . $user->username;
     $path = JPATH_ROOT . '/media/media_chessvn' . $mediaplayer;
     if (JFolder::create($path)) {
         if (JFolder::create($path . '/images')) {
             //tạo thư mục images
             JLog::add(JText::_('khanglq111:--- Create folders sucess'), JLog::INFO);
             $src = JPATH_ROOT . '/media/media_chessvn' . $defaultAvatar;
             $dest = $path . $defaultAvatar;
             if (JFile::copy($src, $dest, null, true)) {
                 //                    $defaultAvatar = '/images/no-avatar.jpg';
                 JLog::add(JText::_('khanglq1421111:--- Copy file ok'), JLog::INFO);
             } else {
                 JLog::add(JText::_('khanglq1421111:--- Copy file failed'), JLog::INFO);
             }
         }
     } else {
         JLog::add(JText::_('khanglq1111421:--- Create folder failed'), JLog::INFO);
     }
     $query = $db->getQuery(true);
     $columns = array('userid', 'coin', 'avatar', 'mediaplayer');
     $values = array($user->id, $newUserCoin, $db->quote($defaultAvatar), $db->quote($mediaplayer));
     $query->insert($db->quoteName('#__player'))->columns($db->quoteName($columns))->values(implode(',', $values));
     $db->setQuery($query);
     $db->execute();
     // Save additional data for rating (user for chessvn)
     $playerId = $db->insertid();
     $query = $db->getQuery(true);
     $columns = array('playerid', 'chesstype', 'ratingtype', 'ratingpoint');
     $values = array($playerId, $chessTypeChess, $db->quote($ratingTypeStandard), $initELO);
     $query->insert($db->quoteName('#__rating'))->columns($db->quoteName($columns))->values(implode(',', $values));
     $db->setQuery($query);
     $db->execute();
     JLog::add(JText::_('khanglq1111:--- Additional data saved. $newUserCoin = ' . $newUserCoin), JLog::INFO);
     //================================================
     // Compile the notification mail values.
     $data = $user->getProperties();
     $data['fromname'] = $config->get('fromname');
     $data['mailfrom'] = $config->get('mailfrom');
     $data['sitename'] = $config->get('sitename');
     $data['siteurl'] = JUri::root();
     // Handle account activation/confirmation emails.
     if ($useractivation == 2) {
         // Set the link to confirm the user email.
         $uri = JURI::getInstance();
         $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
         $data['activate'] = $base . JRoute::_('index.php?option=com_cvnusers&task=registration.activate&token=' . $data['activation'], false);
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         if ($sendpassword) {
             $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_cvnusers&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'], $data['password_clear']);
         } else {
             $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY_NOPW', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_cvnusers&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username']);
//.........这里部分代码省略.........
开发者ID:khangcodt,项目名称:nvssehcweb,代码行数:101,代码来源:registration.php

示例5: ajaxregister

	function ajaxregister()
	{
		
		$lang = JFactory::getLanguage();
		$extension = 'com_users';
		$base_dir = JPATH_SITE;
		$language_tag = $lang->getTag();
		$reload = true;
		$lang->load($extension, $base_dir, $language_tag, $reload);
		$config = JFactory::getConfig();
		$db		= JFactory::getDbo();
		$params = JComponentHelper::getParams('com_users');
		$captchacode=strtolower(JRequest::getVar('captchacode'));
		$session_captchacode=$_SESSION['awdcpnumber'];
		if(strcmp($captchacode,$session_captchacode)!=0){
			// set message in here : Registration is disable
			awdwallController::ajaxResponse('$errorcaptcha$'.JText::_('COM_COMAWDWALL_CAPTCHA_ERROR_TEXT'));
		}
		$requestData ['name']= JRequest::getVar('name');
		$requestData ['username']= JRequest::getVar('username');
		$requestData ['password1']= JRequest::getVar('passwd1');
		$requestData ['password2']= JRequest::getVar('passwd2');
		$requestData ['email1']= JRequest::getVar('email1');
		$requestData ['email2']= JRequest::getVar('email2');
		
		if(JComponentHelper::getParams('com_users')->get('allowUserRegistration') == 0){
			// set message in here : Registration is disable
			awdwallController::ajaxResponse('$error$'.JText::_('COM_COMAWDWALL_REGISTRATION_NOTALLOWED_TEXT'));
		}
		
		// Initialise the table with JUser.
		$user = new JUser;
		
		// Merge in the registration data.
		foreach ($requestData as $k => $v) {
			$data[$k] = $v;
		}

		// Prepare the data for the user object.
		$data['email']		= $data['email1'];
		$data['password']	= $data['password1'];
		$useractivation = $params->get ( 'useractivation' );
		
		// Check if the user needs to activate their account.
		if (($useractivation == 1) || ($useractivation == 2)) {
			$data ['activation'] = JApplication::getHash ( JUserHelper::genRandomPassword () );
			$data ['block'] = 1;
		}
		$system	= $params->get('new_usertype', 2);
		$data['groups'] = array($system);
		
		// Bind the data.
		if (! $user->bind ( $data )) {
			awdwallController::ajaxResponse('$error$'.JText::sprintf ( 'COM_USERS_REGISTRATION_BIND_FAILED', $user->getError () ));
		}
		
		// Load the users plugin group.
		JPluginHelper::importPlugin('user');

		// Store the data.
		if (!$user->save()) {
			awdwallController::ajaxResponse('$error$'.JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
		}

		// Compile the notification mail values.
		$data = $user->getProperties();
		$data['fromname']	= $config->get('fromname');
		$data['mailfrom']	= $config->get('mailfrom');
		$data['sitename']	= $config->get('sitename');
		$data['siteurl']	= JURI::root();
		
		// Handle account activation/confirmation emails.
		if ($useractivation == 2)
		{
			// Set the link to confirm the user email.					
			$data['activate'] = $data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'];
			
			$emailSubject	= JText::sprintf(
				'COM_USERS_EMAIL_ACCOUNT_DETAILS',
				$data['name'],
				$data['sitename']
			);

			$emailBody = JText::sprintf(
				'COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY',
				$data['name'],
				$data['sitename'],
				$data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'],
				$data['siteurl'],
				$data['username'],
				$data['password_clear']
			);
			
		}
		elseif ($useractivation == 1)
		{
			// Set the link to activate the user account.						
			$data['activate'] = $data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'];
		
			$emailSubject	= JText::sprintf(
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:controller.php

示例6: save

 /**
  * Method to save the JUser object to the database
  *
  * @param   boolean  $updateOnly  Save the object only if not a new user
  *                                Currently only used in the user reset password method.
  *
  * @return  boolean  True on success
  *
  * @since   11.1
  * @throws  exception
  */
 public function save($updateOnly = false)
 {
     // Create the user table object
     $table = $this->getTable();
     $this->params = (string) $this->_params;
     $table->bind($this->getProperties());
     // Allow an exception to be thrown.
     try {
         // Check and store the object.
         if (!$table->check()) {
             $this->setError($table->getError());
             return false;
         }
         // If user is made a Super Admin group and user is NOT a Super Admin
         //
         // @todo ACL - this needs to be acl checked
         //
         $my = JFactory::getUser();
         //are we creating a new user
         $isNew = empty($this->id);
         // If we aren't allowed to create new users return
         if ($isNew && $updateOnly) {
             return true;
         }
         // Get the old user
         $oldUser = new JUser($this->id);
         //
         // Access Checks
         //
         // The only mandatory check is that only Super Admins can operate on other Super Admin accounts.
         // To add additional business rules, use a user plugin and throw an Exception with onUserBeforeSave.
         // Check if I am a Super Admin
         $iAmSuperAdmin = $my->authorise('core.admin');
         $iAmRehashingSuperadmin = false;
         if ($my->id == 0 && !$isNew && $this->id == $oldUser->id && $oldUser->authorise('core.admin') && $oldUser->password != $this->password) {
             $iAmRehashingSuperadmin = true;
         }
         // We are only worried about edits to this account if I am not a Super Admin.
         if ($iAmSuperAdmin != true && $iAmRehashingSuperadmin != true) {
             if ($isNew) {
                 // Check if the new user is being put into a Super Admin group.
                 foreach ($this->groups as $groupId) {
                     if (JAccess::checkGroup($groupId, 'core.admin')) {
                         throw new Exception(JText::_('JLIB_USER_ERROR_NOT_SUPERADMIN'));
                     }
                 }
             } else {
                 // I am not a Super Admin, and this one is, so fail.
                 if (JAccess::check($this->id, 'core.admin')) {
                     throw new Exception(JText::_('JLIB_USER_ERROR_NOT_SUPERADMIN'));
                 }
                 if ($this->groups != null) {
                     // I am not a Super Admin and I'm trying to make one.
                     foreach ($this->groups as $groupId) {
                         if (JAccess::checkGroup($groupId, 'core.admin')) {
                             throw new Exception(JText::_('JLIB_USER_ERROR_NOT_SUPERADMIN'));
                         }
                     }
                 }
             }
         }
         // Fire the onUserBeforeSave event.
         JPluginHelper::importPlugin('user');
         $dispatcher = JDispatcher::getInstance();
         $result = $dispatcher->trigger('onUserBeforeSave', array($oldUser->getProperties(), $isNew, $this->getProperties()));
         if (in_array(false, $result, true)) {
             // Plugin will have to raise its own error or throw an exception.
             return false;
         }
         // Store the user data in the database
         if (!($result = $table->store())) {
             throw new Exception($table->getError());
         }
         // Set the id for the JUser object in case we created a new user.
         if (empty($this->id)) {
             $this->id = $table->get('id');
         }
         if ($my->id == $table->id) {
             $registry = new JRegistry();
             $registry->loadString($table->params);
             $my->setParameters($registry);
         }
         // Fire the onUserAfterSave event
         $dispatcher->trigger('onUserAfterSave', array($this->getProperties(), $isNew, $result, $this->getError()));
     } catch (Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     return $result;
//.........这里部分代码省略.........
开发者ID:Arturogcalleja,项目名称:herbolario,代码行数:101,代码来源:user.php

示例7: juserRegister

	public static function juserRegister($juser) {
		$result = array();
		$oseMscconfig = oseRegistry::call('msc')->getConfig('', 'obj');
		$config = JFactory::getConfig();
		$params = JComponentHelper::getParams('com_users');
		$newUserType = self::getNewUserType($params->get('new_usertype'));
		$juser['gid'] = $newUserType;
		$data = (array) self::getJuserData($juser);
		// Initialise the table with JUser.
		$user = new JUser;
		foreach ($juser as $k => $v) {
			$data[$k] = $v;
		}
		// Prepare the data for the user object.
		$useractivation = $params->get('useractivation');
		// Check if the user needs to activate their account.
		if (($useractivation == 1) || ($useractivation == 2)) {
			jimport('joomla.user.helper');
			$data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
			$data['block'] = 1;
		}
		// Bind the data.
		if (!$user->bind($data)) {
			$result['success'] = false;
			$result['title'] = 'Error';
			$result['content'] = JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError());
		}
		// Load the users plugin group.
		JPluginHelper::importPlugin('user');
		if (!$user->save()) {
			$result['success'] = false;
			$result['title'] = 'Error';
			$result['reload'] = ($oseMscconfig->error_registration == 'refresh') ? true : false;
			;
			$result['content'] = JText::_($user->getError());
		} else {
			// Mark the user_id in order to user in payment form
			if (($useractivation == 1) || ($useractivation == 2)) {
				$session = JFactory::getSession();
				$oseUser = array();
				$oseUser['user_id'] = $user->id;
				$oseUser['block'] = true;
				$oseUser['activation'] = true;
				$session->set('ose_user', $oseUser);
			}
			$result['success'] = true;
			$result['user'] = $user;
			$result['title'] = 'Done';
			$result['content'] = 'Juser saved successfully';
			// Compile the notification mail values.
			$data = $user->getProperties();
			$data['fromname'] = $config->get('fromname');
			$data['mailfrom'] = $config->get('mailfrom');
			$data['sitename'] = $config->get('sitename');
			$data['siteurl'] = JUri::base();
			if (JOOMLA16 == true) {
				// Handle account activation/confirmation emails.
				if ($useractivation == 2) {
					// Set the link to confirm the user email.
					$uri = JURI::getInstance();
					$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
					$data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
					$emailSubject = JText::sprintf('COM_USERS_OSEMSC_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
					$emailBody = JText::sprintf('COM_USERS_OSEMSC_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'],
							$data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'],
							$data['password_clear']);
				} else if ($useractivation == 1) {
					// Set the link to activate the user account.
					$uri = JURI::getInstance();
					$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
					$data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
					$emailSubject = JText::sprintf('COM_USERS_OSEMSC_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
					$emailBody = JText::sprintf('COM_USERS_OSEMSC_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'],
							$data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'],
							$data['password_clear']);
				} else {
					$emailSubject = "";
					$emailBody = "";
				}
				// Send the registration email.
				if (!empty($emailSubject) && !empty($emailBody)) {
					if (JOOMLA30 == true) {
						$mailer = new JMail();
						$return = $mailer->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
					} else {
						$return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
					}
				} else {
					$return = true;
				}
				// Check for an error.
				if ($return !== true) {
					$this->setError(JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED'));
					// Send a system message to administrators receiving system mails
					$db = JFactory::getDBO();
					$q = "SELECT id
						FROM #__users
						WHERE block = 0
						AND sendEmail = 1";
					$db->setQuery($q);
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:oseMscPublic.php

示例8: completeReset

 /**
  * Takes the new password and saves it to the database.
  * It will only save the password if the user has the
  * correct user id and token stored in her session.
  *
  * @since	1.5
  * @param	string	New Password
  * @param	string	New Password
  * @return	bool	True on success/false on failure
  */
 function completeReset($password1, $password2)
 {
     jimport('joomla.user.helper');
     $mainframe = JFactory::getApplication();
     $option = JRequest::getCmd('option');
     // Make sure that we have a pasword
     if (!$password1) {
         $this->setError(JText::_('MUST_SUPPLY_PASSWORD'));
         return false;
     }
     // Verify that the passwords match
     if ($password1 != $password2) {
         $this->setError(JText::_('PASSWORDS_DO_NOT_MATCH_LOW'));
         return false;
     }
     // Get the necessary variables
     $db = JFactory::getDBO();
     $id = $mainframe->getUserState($this->_namespace . 'id');
     $token = $mainframe->getUserState($this->_namespace . 'token');
     $salt = JUserHelper::genRandomPassword(32);
     $crypt = JUserHelper::getCryptedPassword($password1, $salt);
     $password = $crypt . ':' . $salt;
     // Get the user object
     $user = new JUser($id);
     // Fire the onBeforeStoreUser trigger
     JPluginHelper::importPlugin('user');
     $dispatcher =& JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeStoreUser', array($user->getProperties(), false));
     // Build the query
     $query = 'UPDATE #__users' . ' SET password = ' . $db->Quote($password) . ' , activation = ""' . ' WHERE id = ' . (int) $id . ' AND activation = ' . $db->Quote($token) . ' AND block = 0';
     $db->setQuery($query);
     // Save the password
     if (!($result = $db->query())) {
         $this->setError(JText::_('DATABASE_ERROR'));
         return false;
     }
     // Update the user object with the new values.
     $user->password = $password;
     $user->activation = '';
     $user->password_clear = $password1;
     // Fire the onAfterStoreUser trigger
     $dispatcher->trigger('onAfterStoreUser', array($user->getProperties(), false, $result, $this->getError()));
     // Flush the variables from the session
     $mainframe->setUserState($this->_namespace . 'id', null);
     $mainframe->setUserState($this->_namespace . 'token', null);
     return true;
 }
开发者ID:kbaerthel,项目名称:com_clm,代码行数:57,代码来源:reset.php

示例9: registerUser

 public static function registerUser($profile)
 {
     $params = JComponentHelper::getParams('com_users');
     // Initialise the table with JUser.
     $user = new JUser();
     $data = array();
     if (!$profile->email) {
         $profile->email = $profile->id + 200000 . '@sibdiet.net';
     }
     // Prepare the data for the user object.
     $data['name'] = $profile->fname . ' ' . $profile->lname;
     $data['username'] = (string) ($profile->id + 200000);
     $data['email'] = JStringPunycode::emailToPunycode($profile->email);
     $data['password'] = $profile->mobile;
     $data['groups'][] = $params->get('new_usertype', 2);
     // Bind the data.
     if (!$user->bind($data)) {
         $user->setError(JText::sprintf('COM_SIBDIET_ERR_REGISTRATION_BIND_FAILED', $user->getError()));
         return false;
     }
     // Load the users plugin group.
     JPluginHelper::importPlugin('user');
     // Store the data.
     if (!$user->save()) {
         $user->setError($user->getError());
         return false;
     }
     $config = JFactory::getConfig();
     // Compile the notification mail values.
     $data = $user->getProperties();
     $data['fromname'] = $config->get('fromname');
     $data['mailfrom'] = $config->get('mailfrom');
     $data['sitename'] = $config->get('sitename');
     $data['siteurl'] = JUri::root();
     // Handle account activation/confirmation emails.
     $emailSubject = JText::sprintf('COM_SIBDIET_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
     $emailBody = JText::sprintf('COM_SIBDIET_EMAIL_REGISTERED_BODY', $data['name'], $data['sitename'], $data['siteurl'], $data['username'], $data['password_clear']);
     // Send the registration email.
     $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody, true);
     // Check for an error.
     if ($return !== true) {
         $user->setError(JText::_('COM_SIBDIET_ERR_REGISTRATION_SEND_MAIL_FAILED'));
     }
     return $user->id;
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:45,代码来源:sibdiet.php

示例10: register

    /**
     * Method to save the form data.
     *
     * @param   array  $temp  The form data.
     *
     * @return  mixed  The user id on success, false on failure.
     *
     * @since   1.6
     */
    public function register($temp)
    {
        $params = JComponentHelper::getParams('com_users');
        // Initialise the table with JUser.
        $user = new JUser();
        $data = (array) $this->getData();
        // Merge in the registration data.
        foreach ($temp as $k => $v) {
            $data[$k] = $v;
        }
        // Prepare the data for the user object.
        $data['email'] = JStringPunycode::emailToPunycode($data['email1']);
        $data['password'] = $data['password1'];
        $useractivation = $params->get('useractivation');
        $sendpassword = $params->get('sendpassword', 1);
        // Check if the user needs to activate their account.
        if ($useractivation == 1 || $useractivation == 2) {
            $data['activation'] = JApplicationHelper::getHash(JUserHelper::genRandomPassword());
            $data['block'] = 1;
        }
        // Bind the data.
        if (!$user->bind($data)) {
            $this->setError(JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
            return false;
        }
        // Load the users plugin group.
        JPluginHelper::importPlugin('user');
        // Store the data.
        if (!$user->save()) {
            $this->setError(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
            return false;
        }
        $config = JFactory::getConfig();
        $db = $this->getDbo();
        $query = $db->getQuery(true);
        // Compile the notification mail values.
        $data = $user->getProperties();
        $data['fromname'] = $config->get('fromname');
        $data['mailfrom'] = $config->get('mailfrom');
        $data['sitename'] = $config->get('sitename');
        $data['siteurl'] = JUri::root();
        // Handle account activation/confirmation emails.
        if ($useractivation == 2) {
            // Set the link to confirm the user email.
            $uri = JUri::getInstance();
            $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
            $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
            $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
            #################################################################
            if ($sendpassword) {
                $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['activate'], $data['siteurl'], $data['username'], $data['password_clear']);
            } else {
                $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY_NOPW', $data['name'], $data['sitename'], $data['activate'], $data['siteurl'], $data['username']);
            }
        } elseif ($useractivation == 1) {
            // Set the link to activate the user account.
            $uri = JUri::getInstance();
            $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
            $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
            $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
            if ($sendpassword) {
                /*$emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY',
                $data['name'],
                $data['sitename'],
                $data['activate'],
                $data['siteurl'],$data['username'],
                $data['password_clear']
                ); */
                $serverurl = $_SERVER['HTTP_HOST'];
                $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width; maximum-scale=1.0;">
<title>RAS</title>

<style type="text/css">
 body{ margin:0px; padding:0px;}
@media only screen and (max-width:598px){
table[class="mainWd"]{ width:100% !important; }
.img{ width:100% !important; }
}
@media only screen and (max-width:599px){
table{ float:none !important; }
table[class="mainWd"]{ width:100% !important; }
table[class="table-width"]{ float:left !important}
.img{ width:100% !important; }
@media only screen and (max-width:480px){
td[class="wd660"]{ width:100% !important; float:left !important; text-align:center !important; }
.img1{ display:none !important}
td[class="wd360"]{ width:100% !important; float:left !important; text-align:center; margin-bottom:20px; }	
//.........这里部分代码省略.........
开发者ID:ranrolls,项目名称:refine-ras-admin,代码行数:101,代码来源:registration.php

示例11: juserRegister

 public static function juserRegister($juser)
 {
     $result = array();
     $config = JFactory::getConfig();
     $params = JComponentHelper::getParams('com_users');
     $newUserType = self::getNewUserType($params->get('new_usertype'));
     $juser['gid'] = $newUserType;
     $data = (array) self::getJuserData($juser);
     // Initialise the table with JUser.
     $user = new JUser();
     foreach ($juser as $k => $v) {
         $data[$k] = $v;
     }
     // Prepare the data for the user object.
     //$data['email']		= $data['email1'];
     //$data['password']	= $data['password1'];
     $useractivation = $params->get('useractivation');
     // Check if the user needs to activate their account.
     /*if (($useractivation == 1) || ($useractivation == 2)) {
     			jimport('joomla.user.helper');
     			$data['activation'] = JUtility::getHash(JUserHelper::genRandomPassword());
     			$data['block'] = 1;
     		}*/
     // Bind the data.
     if (!$user->bind($data)) {
         $this->setError(JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
         return false;
     }
     // Load the users plugin group.
     JPluginHelper::importPlugin('user');
     if (!$user->save()) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = JText::_($user->getError());
         $result = oseJson::encode($result);
         oseExit($result);
     } else {
         $result['success'] = true;
         $result['user'] = $user;
         $result['title'] = 'Done';
         $result['content'] = 'Juser saved successfully';
         // Compile the notification mail values.
         $data = $user->getProperties();
         $data['fromname'] = $config->get('fromname');
         $data['mailfrom'] = $config->get('mailfrom');
         $data['sitename'] = $config->get('sitename');
         $data['siteurl'] = JUri::base();
         /*if (JOOMLA16==true)	{
         				// Handle account activation/confirmation emails.
         				if ($useractivation == 2)
         				{
         					// Set the link to confirm the user email.
         					$uri = JURI::getInstance();
         					$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
         					$data['activate'] = $base.JRoute::_('index.php?option=com_users&task=registration.activate&token='.$data['activation'], false);
         
         					$emailSubject	= JText::sprintf(
         						'COM_USERS_EMAIL_ACCOUNT_DETAILS',
         						$data['name'],
         						$data['sitename']
         					);
         
         					$emailBody = JText::sprintf(
         						'COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY',
         						$data['name'],
         						$data['sitename'],
         						$data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'],
         						$data['siteurl'],
         						$data['username'],
         						$data['password_clear']
         					);
         				}
         				else if ($useractivation == 1)
         				{
         					// Set the link to activate the user account.
         					$uri = JURI::getInstance();
         					$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
         					$data['activate'] = $base.JRoute::_('index.php?option=com_users&task=registration.activate&token='.$data['activation'], false);
         
         					$emailSubject	= JText::sprintf(
         						'COM_USERS_EMAIL_ACCOUNT_DETAILS',
         						$data['name'],
         						$data['sitename']
         					);
         
         					$emailBody = JText::sprintf(
         						'COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY',
         						$data['name'],
         						$data['sitename'],
         						$data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'],
         						$data['siteurl'],
         						$data['username'],
         						$data['password_clear']
         					);
         				} else {
         
         					$emailSubject	= "";
         
         					$emailBody = "";
         				}
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:oseMscPublic.php

示例12: register

 function register($bypass_plugin, $bypass_verification_name, $verification_id, $user_id, $the_name_field, $the_username_field, $the_email_field, $the_password_field)
 {
     if ($the_name_field === null || $the_email_field === null || $the_password_field === null || $the_username_field === null) {
         return 0;
     }
     if ($user_id) {
         jimport('joomla.user.helper');
         $db = JFactory::getDBO();
         $pw = '';
         if (!empty($the_password_field)) {
             $salt = JUserHelper::genRandomPassword(32);
             $crypt = JUserHelper::getCryptedPassword($the_password_field, $salt);
             $pw = $crypt . ':' . $salt;
         }
         $db->setQuery("Update #__users Set `name` = " . $db->Quote($the_name_field) . ", `username` = " . $db->Quote($the_username_field) . ", `email` = " . $db->Quote($the_email_field) . " " . (!empty($pw) ? ", `password` = '{$pw}'" : '') . " Where id = " . intval($user_id));
         $db->query();
         return $user_id;
     }
     // else execute the registration
     if ($this->is15) {
         return $this->register15($bypass_plugin, $bypass_verification_name, $verification_id, $the_name_field, $the_username_field, $the_email_field, $the_password_field);
     }
     jimport('joomla.version');
     $version = new JVersion();
     JFactory::getLanguage()->load('com_users', JPATH_SITE);
     $config = JFactory::getConfig();
     $params = JComponentHelper::getParams('com_users');
     // Initialise the table with JUser.
     $user = new JUser();
     $data = array();
     $data['activation'] = '';
     $data['block'] = 0;
     // Prepare the data for the user object.
     $data['email'] = $the_email_field;
     $data['password'] = $the_password_field;
     $data['password_clear'] = $the_password_field;
     $data['name'] = $the_name_field;
     $data['username'] = $the_username_field;
     $data['groups'] = array($params->get('new_usertype'));
     $useractivation = $params->get('useractivation');
     // Check if the user needs to activate their account.
     if ($useractivation == 1 || $useractivation == 2) {
         jimport('joomla.user.helper');
         if (version_compare($version->getShortVersion(), '3.0', '<')) {
             $data['activation'] = JUtility::getHash(JUserHelper::genRandomPassword());
         } else {
             $data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
         }
         $data['block'] = 1;
     }
     // Bind the data.
     if (!$user->bind($data)) {
         $this->setError(JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
         return false;
     }
     // Load the users plugin group.
     JPluginHelper::importPlugin('user');
     // Store the data.
     if (!$user->save()) {
         $this->setError(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
         return false;
     }
     // Compile the notification mail values.
     $data = $user->getProperties();
     $data['fromname'] = $config->get('fromname');
     $data['mailfrom'] = $config->get('mailfrom');
     $data['sitename'] = $config->get('sitename');
     $data['siteurl'] = JUri::base();
     // Handle account activation/confirmation emails.
     if ($useractivation == 2) {
         // Set the link to confirm the user email.
         $uri = JURI::getInstance();
         $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
         $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         $siteurl = $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'];
         if ($bypass_plugin) {
             $siteurl = $data['siteurl'] . 'index.php?option=com_contentbuilder&controller=verify&plugin=' . urlencode($bypass_plugin) . '&verification_name=' . urlencode($bypass_verification_name) . '&token=' . $data['activation'] . '&verification_id=' . $verification_id . '&format=raw';
         }
         $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'], $siteurl, $data['siteurl'], $data['username'], $data['password_clear']);
     } else {
         if ($useractivation == 1) {
             // Set the link to activate the user account.
             $uri = JURI::getInstance();
             $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
             $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
             $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
             $siteurl = $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'];
             if ($bypass_plugin) {
                 $siteurl = $data['siteurl'] . 'index.php?option=com_contentbuilder&controller=verify&plugin=' . urlencode($bypass_plugin) . '&verification_name=' . urlencode($bypass_verification_name) . '&token=' . $data['activation'] . '&verification_id=' . $verification_id . '&format=raw';
             }
             $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'], $siteurl, $data['siteurl'], $data['username'], $data['password_clear']);
         } else {
             $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
             $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_BODY', $data['name'], $data['sitename'], $data['siteurl']);
         }
     }
     // Send the registration email.
     if (version_compare($version->getShortVersion(), '3.0', '<')) {
         $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
//.........这里部分代码省略.........
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:edit.php

示例13: save

 /**
  * Method to save the JUser object to the database
  *
  * @access 	public
  * @param 	boolean $updateOnly Save the object only if not a new user
  * @return 	boolean 			True on success
  * @since 1.5
  */
 function save($updateOnly = false)
 {
     // Create the user table object
     $table =& $this->getTable();
     $this->params = $this->_params->toString();
     $table->bind($this->getProperties());
     // Check and store the object.
     if (!$table->check()) {
         $this->setError($table->getError());
         return false;
     }
     //are we creating a new user
     $isnew = !$this->id;
     // If we aren't allowed to create new users return
     if ($isnew && $updateOnly) {
         return false;
     }
     // Get the old user
     $old = new JUser($this->id);
     // Fire the onBeforeStoreUser event.
     JPluginHelper::importPlugin('user');
     $dispatcher =& JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeStoreUser', array($old->getProperties(), $isnew));
     //Store the user data in the database
     if (!($result = $table->store())) {
         $this->setError($table->getError());
     }
     // Set the id for the JUser object in case we created a new user.
     if (empty($this->id)) {
         $this->id = $table->get('id');
     }
     //Fire the onAftereStoreUser event
     $dispatcher->trigger('onAfterStoreUser', array($this->getProperties(), $isnew, $result, $this->getError()));
     return $result;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:43,代码来源:user.php

示例14: register

 /**
  * Method to save the form data.
  *
  * @param	array		The form data.
  * @return	mixed		The user id on success, false on failure.
  * @since	1.6
  */
 public function register($temp)
 {
     $config = JFactory::getConfig();
     $db = $this->getDbo();
     $params = JComponentHelper::getParams('com_users');
     // Initialise the table with JUser.
     $user = new JUser();
     $data = (array) $this->getData();
     // Merge in the registration data.
     foreach ($temp as $k => $v) {
         $data[$k] = $v;
     }
     // Prepare the data for the user object.
     $data['email'] = $data['email1'];
     $data['password'] = $data['password1'];
     $useractivation = $params->get('useractivation');
     $sendpassword = $params->get('sendpassword', 1);
     // Check if the user needs to activate their account.
     // if (($useractivation == 1) || ($useractivation == 2)) {
     // 	$data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
     // 	$data['block'] = 1;
     // }
     // Bind the data.
     if (!$user->bind($data)) {
         $this->setError(JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
         return false;
     }
     // Load the users plugin group.
     JPluginHelper::importPlugin('user');
     // Store the data.
     if (!$user->save()) {
         $this->setError(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
         return false;
     }
     // Compile the notification mail values.
     $data = $user->getProperties();
     $data['fromname'] = $config->get('fromname');
     $data['mailfrom'] = $config->get('mailfrom');
     $data['sitename'] = $config->get('sitename');
     $data['siteurl'] = JUri::root();
     // Handle account activation/confirmation emails.
     if ($useractivation == 2) {
         // Set the link to confirm the user email.
         $uri = JURI::getInstance();
         $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
         $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         if ($sendpassword) {
             $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl']);
         } else {
             $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY_NOPW', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username']);
         }
     } elseif ($useractivation == 1) {
         // Set the link to activate the user account.
         $uri = JURI::getInstance();
         $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
         $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         if ($sendpassword) {
             $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl']);
         } else {
             $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPW', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username']);
         }
     } else {
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_BODY', $data['name'], $data['sitename'], $data['siteurl']);
     }
     // Send the registration email.
     //$emailBody = Ideary::emailBody($data['name'],$data['sitename'],$data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'],$data['siteurl']);
     $emailBody = Ideary::emailBodyTable($data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl']);
     //$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
     /*Rodrigo cambio esto para que funcione*/
     $headers = 'MIME-Version: 1.0' . "\r\n";
     $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
     //$headers .= 'To: '.$data['email'].' <'.$data['email'].'>' . "\r\n";
     $headers .= 'From: ' . $data['fromname'] . ' <' . $data['mailfrom'] . '>' . "\r\n";
     $return = mail($data['email'], $emailSubject, $emailBody, $headers);
     //	$return2 = mail("ra@2bigideas.com", $emailSubject, $emailBody,$headers);
     //Send Notification mail to administrators
     if ($params->get('useractivation') < 2 && $params->get('mail_to_admin') == 1) {
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         $emailBodyAdmin = JText::sprintf('COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY', $data['name'], $data['username'], $data['siteurl']);
         // get all admin users
         $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE sendEmail=1';
         $db->setQuery($query);
         $rows = $db->loadObjectList();
         // Send mail to all superadministrators id
         foreach ($rows as $row) {
             $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $row->email, $emailSubject, $emailBodyAdmin);
             // Check for an error.
             if ($return !== true) {
                 $this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED'));
                 return false;
//.........这里部分代码省略.........
开发者ID:lautarodragan,项目名称:ideary,代码行数:101,代码来源:registration.php

示例15: register

 /**
  * Method to save the form data.
  *
  * @access	public
  * @param	array		$data		The form data.
  * @return	mixed		The user id on success, false on failure.
  * @since	1.0
  */
 function register($temp)
 {
     $config =& JFactory::getConfig();
     $params =& JComponentHelper::getParams('com_users');
     // Initialise the table with JUser.
     JUser::getTable('User', 'JTable');
     $user = new JUser();
     $data = (array) $this->getData();
     // Merge in the registration data.
     foreach ($data as $k => $v) {
         $temp[$k] = $v;
     }
     $data = $temp;
     // Prepare the data for the user object.
     $data['email'] = $data['email1'];
     $data['password'] = $data['password1'];
     // Check if the user needs to activate their account.
     if ($params->get('useractivation')) {
         jimport('joomla.user.helper');
         $data['activation'] = JUtility::getHash(JUserHelper::genRandomPassword());
         $data['block'] = 1;
     }
     // Bind the data.
     if (!$user->bind($data)) {
         $this->setError(JText::sprintf('USERS REGISTRATION BIND FAILED', $user->getError()));
         return false;
     }
     // Load the users plugin group.
     JPluginHelper::importPlugin('users');
     // Store the data.
     if (!$user->save()) {
         $this->setError($user->getError());
         return false;
     }
     // Compile the notification mail values.
     $data = $user->getProperties();
     $data['fromname'] = $config->getValue('fromname');
     $data['mailfrom'] = $config->getValue('mailfrom');
     $data['sitename'] = $config->getValue('sitename');
     // Handle account activation/confirmation e-mails.
     if ($params->get('useractivation')) {
         // Set the link to activate the user account.
         $uri =& JURI::getInstance();
         $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
         $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
         // Get the registration activation e-mail.
         $message = 'com_users.registration.activate';
     } else {
         // Get the registration confirmation e-mail.
         $message = 'com_users.registration.confirm';
     }
     // Load the message template and bind the data.
     jimport('joomla.utilities.simpletemplate');
     $template = JxSimpleTemplate::getInstance($message);
     $template->bind($data);
     // Send the registration e-mail.
     $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $template->getTitle(), $template->getBody());
     // Check for an error.
     if ($return !== true) {
         $this->setError(JText::_('USERS REGISTRATION SEND MAIL FAILED'));
         return false;
     }
     return $user->id;
 }
开发者ID:joebushi,项目名称:joomla,代码行数:72,代码来源:registration.php


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