Пример #1
0
 /**
  * Returns yes/no
  * @param object
  * @param mixed Boolean
  * @return array
  */
 function _sendMail(&$user, $details, $useractivation, $guest = false)
 {
     $lang = JFactory::getLanguage();
     $lang->load('com_citruscart', JPATH_ADMINISTRATOR);
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $name = $user->get('name');
     $email = $user->get('email');
     $username = $user->get('username');
     $activation = $user->get('activation');
     $password = $details['password2'];
     // using the original generated pword for the email
     $usersConfig = JComponentHelper::getParams('com_users');
     // $useractivation = $usersConfig->get( 'useractivation' );
     $sitename = $mainframe->getCfg('sitename');
     $mailfrom = $mainframe->getCfg('mailfrom');
     $fromname = $mainframe->getCfg('fromname');
     $siteURL = JURI::base();
     $subject = sprintf(JText::_('COM_CITRUSCART_ACCOUNT_DETAILS_FOR'), $name, $sitename);
     $subject = html_entity_decode($subject, ENT_QUOTES);
     if ($useractivation == 1) {
         $message = sprintf(JText::_('COM_CITRUSCART_EMAIL_MESSAGE_ACTIVATION'), $sitename, $siteURL, $username, $password, $activation);
     } else {
         $message = sprintf(JText::_('COM_CITRUSCART_EMAIL_MESSAGE'), $sitename, $siteURL, $username, $password);
     }
     if ($guest) {
         $message = sprintf(JText::_('COM_CITRUSCART_EMAIL_MESSAGE_GUEST'), $sitename, $siteURL, $username, $password);
     }
     $message = html_entity_decode($message, ENT_QUOTES);
     //get all super administrator
     /*$query = 'SELECT name, email, sendEmail' .
                     ' FROM #__users' .
                     ' WHERE LOWER( usertype ) = "super administrator"';
     		$db->setQuery( $query );
     		$rows = $db->loadObjectList();*/
     $rows = DSCAcl::getAdminList();
     // Send email to user
     if (!$mailfrom || !$fromname) {
         $fromname = $rows[0]->name;
         $mailfrom = $rows[0]->email;
     }
     $success = CitruscartHelperUser::doMail($mailfrom, $fromname, $email, $subject, $message);
     return $success;
 }