Version 3.2.3

This commit is contained in:
Neo committed 2025-12-19 00:34:03 -08:00
1 parent ae5c01cc78
commit 78706903a2
2641 files changed
+228363 -201264

No files matched your search

+14 -51
View File
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Editor Library: Gateway
* Last Updated: $Date: 2010-11-12 13:07:33 -0500 (Fri, 12 Nov 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since 9th March 2005 11:03
* @version $Revision: 7174 $
* @version $Revision: 8644 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -37,23 +37,7 @@ class hanEditor
* @var string
*/
public $method = '';
/**
* Editor width
*
* @var string
* @deprecated
*/
public $ed_width = '650px';
/**
* Editor height
*
* @var string
* @deprecated
*/
public $ed_height = '250px';
/**
* RTE enabled?
*
@@ -115,8 +99,8 @@ class hanEditor
/**
* Constructor
*
* @param object Registry object
* @return void
* @param object $registry Registry object
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
@@ -136,7 +120,7 @@ class hanEditor
* Init method
*
* @param object Registry object
* @return void
* @return @e void
*/
public function init()
{
@@ -156,12 +140,6 @@ class hanEditor
$this->method = $this->memberData['members_editor_choice'];
}
//-----------------------------------------
// Fix width
//-----------------------------------------
$this->ed_width = $this->settings['rte_width'] ? $this->settings['rte_width'] : $this->ed_width;
//-----------------------------------------
// Make sure we haven't had any messin'
//-----------------------------------------
@@ -194,19 +172,6 @@ class hanEditor
{
$this->method = 'std';
}
//-----------------------------------------
// Sneaky Opera or Safari
//-----------------------------------------
if ( $this->method == 'rte' )
{
if ( $this->memberData['_canUseRTE'] !== TRUE )
{
$this->method = 'std';
$this->force_editor_change = 1;
}
}
//-----------------------------------------
// Which class
@@ -231,7 +196,7 @@ class hanEditor
// Load classes
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/editor/class_editor.php' );
require_once( IPS_ROOT_PATH . 'sources/classes/editor/class_editor.php' );/*noLibHook*/
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/' . $class, 'class_editor_module' );
$this->class_editor = new $classToLoad( $this->registry );
@@ -261,14 +226,12 @@ class hanEditor
$this->image_dir = $image_set['set_image_dir'];
$this->emo_dir = $image_set['set_emo_dir'];
$this->settings['img_url'] = $this->settings['board_url'] . "/public/style_images/{$this->image_dir}" ;
//-----------------------------------------
// Remove side panel
//-----------------------------------------
$this->remove_emoticons = 1;
$this->remove_emoticons = true;
}
else
{
@@ -338,8 +301,8 @@ class hanEditor
{
$return_html = $this->registry->getClass('output')->global_template->ips_editor( $form_field, $text, $this->settings['img_url'].'/folder_editor_images/', $this->rte_on, $this->editor_id, $smilies );
$return_html = preg_replace( '#([^/\.])js/#is', "\\1".$this->settings['board_url']."/public/js/" , $return_html );
$return_html = str_replace( "<#IMG_DIR#>" , $this->settings['board_url']."/public/style_images/{$this->image_dir}", $return_html );
$return_html = preg_replace( '#([^/\.])js/#is', "\\1".$this->settings['board_url'] . '/' . PUBLIC_DIRECTORY . "/js/" , $return_html );
$return_html = str_replace( "<#IMG_DIR#>" , $this->settings['board_url'] . '/' . PUBLIC_DIRECTORY . "/style_images/{$this->image_dir}", $return_html );
}
else
{
+365 -70
View File
@@ -2,17 +2,17 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* API: Core
* Last Updated: $Date: 2010-11-12 13:07:33 -0500 (Fri, 12 Nov 2010) $
* Last Updated: $Date: 2011-10-03 11:31:57 -0400 (Mon, 03 Oct 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @author $Author: mark $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @link http://www.invisionpower.com
* @version $Rev: 7174 $
* @link http://hatynka.in
* @version $Rev: 9573 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -58,6 +58,13 @@ class hanEmail
*/
public $to;
/**
* Email cc's
*
* @var array
*/
public $cc = array();
/**
* Email bcc's
*
@@ -79,21 +86,33 @@ class hanEmail
*/
public $message;
/**
* HTML Mode
*
* @var bool
*/
public $html_email = FALSE;
/**
* Temp word swapping array
*
* @var array
*/
private $_words;
protected $_words;
/**
* Headers to pass to email lib
*
* @var array
*/
private $temp_headers = array();
protected $temp_headers = array();
private $_attachments = array();
protected $_attachments = array();
protected $editor;
protected $plainTextTemplate = '';
protected $htmlTemplate = '';
protected $htmlWrapper = '';
protected $_loadedHtmlTemplateClass = '';
/**#@+
* Registry Object Shortcuts
@@ -113,7 +132,7 @@ class hanEmail
* Construct
*
* @param object ipsRegistry reference
* @return void
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
@@ -125,42 +144,55 @@ class hanEmail
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
/* Set up default handler */
$this->setHtmlEmail( $this->settings['email_use_html'] );
}
/**
* Sets whether or not this is a HTML email
* @param boolean duh $boolean
*/
public function setHtmlEmail( $boolean=null )
{
$this->html_email = ( $boolean ) ? true : false;
if ( is_object( $this->emailer ) )
{
$this->emailer->setHtmlEmail( $boolean );
}
}
/**
* Init method (setup stuff)
*
* @return void
* @return @e void
*/
public function init()
{
$this->header = $this->settings['email_header'] ? $this->settings['email_header'] : '';
$this->footer = $this->settings['email_footer'] ? $this->settings['email_footer'] : '';
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classEmail.php', 'classEmail' );
$this->emailer = new $classToLoad(
array(
'debug' => $this->settings['fake_mail'] ? $this->settings['fake_mail'] : '0',
'debug_path' => DOC_IPS_ROOT_PATH . '_mail',
'smtp_host' => $this->settings['smtp_host'] ? $this->settings['smtp_host'] : 'localhost',
'smtp_port' => intval($this->settings['smtp_port']) ? intval($this->settings['smtp_port']) : 25,
'smtp_user' => $this->settings['smtp_user'],
'smtp_pass' => $this->settings['smtp_pass'],
'smtp_helo' => $this->settings['smtp_helo'],
'method' => $this->settings['mail_method'],
'wrap_brackets' => $this->settings['mail_wrap_brackets'],
'extra_opts' => $this->settings['php_mail_extra'],
'charset' => IPS_DOC_CHAR_SET,
'html' => intval($this->settings['html_email']),
)
);
$this->emailer = new $classToLoad( array( 'debug' => $this->settings['fake_mail'] ? $this->settings['fake_mail'] : '0',
'debug_path' => DOC_IPS_ROOT_PATH . '_mail',
'smtp_host' => $this->settings['smtp_host'] ? $this->settings['smtp_host'] : 'localhost',
'smtp_port' => intval($this->settings['smtp_port']) ? intval($this->settings['smtp_port']) : 25,
'smtp_user' => $this->settings['smtp_user'],
'smtp_pass' => $this->settings['smtp_pass'],
'smtp_helo' => $this->settings['smtp_helo'],
'method' => $this->settings['mail_method'],
'wrap_brackets' => $this->settings['mail_wrap_brackets'],
'extra_opts' => $this->settings['php_mail_extra'],
'charset' => IPS_DOC_CHAR_SET,
'html' => $this->html_email ) );
}
/**
* Clear out any temporary headers
*
* @return void
* @return @e void
*/
public function clearHeaders()
{
@@ -172,7 +204,7 @@ class hanEmail
*
* @param string Header key
* @param string Header value
* @return void
* @return @e void
*/
public function setHeader( $key, $value )
{
@@ -185,11 +217,14 @@ class hanEmail
* @return boolean Email sent successfully
*/
public function sendMail()
{
//$this->emailer->clearEmail();
//$this->emailer->clearError();
{
$this->init();
if( $this->emailer->error )
{
return $this->fatalError( $this->emailer->error_msg, $this->emailer->error_help );
}
/* Add attachments if any */
if ( count( $this->_attachments ) )
{
@@ -204,6 +239,10 @@ class hanEmail
$this->emailer->setFrom( $this->from ? $this->from : $this->settings['email_out'], $this->settings['board_name'] );
$this->emailer->setTo( $this->to );
foreach( $this->cc as $cc )
{
$this->emailer->addCC( $cc );
}
foreach( $this->bcc as $bcc )
{
$this->emailer->addBCC( $bcc );
@@ -224,9 +263,33 @@ class hanEmail
//-----------------------------------------
$this->emailer->setSubject( $this->_cleanSubject($this->subject) );
$this->emailer->setBody( $this->message );
/* If we're sending a HTML email, we need to manually send the plain text and HTML versions */
if ( $this->html_email )
{
/* Dynamically replace subject in template */
$this->htmlTemplate = str_ireplace( array('<#subject#>'), IPSText::utf8ToEntities( $this->_cleanSubject($this->subject) ), $this->htmlTemplate );
$this->emailer->setPlainTextContent( $this->plainTextTemplate );
$this->emailer->setHtmlContent( $this->htmlTemplate );
}
else if ( $this->message && ! $this->plainTextTemplate )
{
/* Older methods pass message directly */
$this->emailer->setBody( $this->message );
}
else
{
$this->emailer->setBody( $this->plainTextTemplate );
}
$this->emailer->sendMail();
/* Clear out stuffs */
$this->clearContent();
// Unset HTML setting to remain backwards compatibility
//$this->html_email = FALSE;
if( $this->emailer->error )
{
return $this->fatalError( $this->emailer->error_msg, $this->emailer->error_help );
@@ -234,7 +297,69 @@ class hanEmail
return true;
}
/**
* Set the plain text template
* @param string $string
*/
public function setPlainTextTemplate( $string )
{
/* Reset message too */
$this->message = '';
$this->plainTextTemplate = $string;
}
/**
* Set the HTML template
* @param string $string
*/
public function setHtmlTemplate( $string )
{
/* Reset message too */
$this->message = '';
$this->htmlTemplate = $string;
}
/**
* Return plain text content
* @return string
*/
public function getPlainTextContent()
{
return $this->plainTextTemplate;
}
/**
* Return HTML content
* @return string
*/
public function getHtmlContent()
{
return $this->htmlTemplate;
}
/**
* Removes all current stored messages, templates, etc.
*/
public function clearContent()
{
$this->setHtmlTemplate('');
$this->setPlainTextTemplate('');
$this->message = '';
$this->template = '';
}
/**
* Send custom html wrapper - HTML wrapper with <#content#> tag where content will be
* @param string $string
*/
public function setHtmlWrapper( $string )
{
$this->htmlWrapper = $string;
}
/**
* Retrieve an email template
*
@@ -242,10 +367,13 @@ class hanEmail
* @param string Language to use
* @param string Language file to load
* @param string Application of language file
* @return void
* @return @e void
*/
public function getTemplate( $name, $language="", $lang_file='public_email_content', $app='core' )
{
/* Reset $this->message as legacy methods use $this->message when sending notifications, etc */
$this->clearContent();
//-----------------------------------------
// Check..
//-----------------------------------------
@@ -305,7 +433,10 @@ class hanEmail
// Return
//-----------------------------------------
$this->template = stripslashes($this->lang->words['email_header']) . stripslashes($this->lang->words[ $name ]) . stripslashes($this->lang->words['email_footer']);
$this->template = stripslashes($this->lang->words[ $name ]) . stripslashes($this->lang->words['email_footer']);
/* Returns it if called via setPlainTextTemplate */
return $this->template;
}
/**
@@ -313,51 +444,180 @@ class hanEmail
*
* @param array Replacement keys to values
* @param bool Do not "clean"
* @return void
* @return @e void
*/
public function buildMessage( $words, $noClean=false )
public function buildMessage( $words, $noClean=false, $rawHtml=FALSE )
{
if( $this->template == "" )
/* Init */
$ptWords = array();
$htmlWords = array();
/* Try this first */
if ( ! $this->plainTextTemplate && ! $this->htmlTemplate && $this->message )
{
$this->setPlainTextTemplate( $this->message );
}
/* need to converge some stuff here */
if ( ! $this->plainTextTemplate )
{
/* Sniff, sniff */
if ( stristr( $this->template, '<br' ) )
{
$this->setHtmlTemplate( $this->template );
}
else
{
$this->setPlainTextTemplate( $this->template );
}
}
/* HTML enabled but no specific template: Auto convert */
if ( $this->html_email && ! $this->htmlTemplate )
{
/* It will be dynamically updated at the end */
$this->setHtmlTemplate( $this->plainTextTemplate );
}
/* HTML email with HTML template but no plain text version */
if ( $this->htmlTemplate && ! $this->plainTextTemplate )
{
$msg = $this->htmlTemplate;
$msg = preg_replace( '/<#(.+?)#>/', '{{{-\1-}}}', $msg );
$msg = str_replace( "<br />", "\n", $msg );
$msg = str_replace( "<br>" , "\n", $msg );
$msg = strip_tags( $msg );
$msg = html_entity_decode( $msg, ENT_QUOTES );
$msg = str_replace( '&#092;', '\\', $msg );
$msg = str_replace( '&#036;', '$', $msg );
$msg = preg_replace( '/\{\{\{(.+?)\}\}\}/', '<#\1#>', $msg );
$this->setPlainTextTemplate( $msg );
}
if ( $this->plainTextTemplate && ! $this->template && ! $this->htmlTemplate )
{
$this->error++;
$this->fatalError( "Could not build the email message, no template assigned", "Make sure a template is assigned first." );
}
$this->message = $this->template;
if( $noClean )
{
$this->message = str_replace( "\n", "<br />", str_replace( "\r", "", $this->message ) );
}
//-----------------------------------------
// Add some default words
//-----------------------------------------
/* Bit more clean up */
$this->plainTextTemplate = str_replace( array( "\r\n", "\r", "\n" ), "\n", $this->plainTextTemplate );
$this->htmlTemplate = str_replace( array( "\r\n", "\r", "\n" ), "\n", $this->htmlTemplate );
/* Add some default words */
$words['BOARD_ADDRESS'] = $this->settings['board_url'] . '/index.' . $this->settings['php_ext'];
$words['WEB_ADDRESS'] = $this->settings['home_url'];
$words['BOARD_NAME'] = $this->settings['board_name'];
$words['SIGNATURE'] = $this->settings['signature'] ? $this->settings['signature'] : '';
//-----------------------------------------
// Swap the words
// 10.7.08 - Added replacements in subject
//-----------------------------------------
if( !$noClean )
/* Swap the words: 10.7.08 - Added replacements in subject */
foreach( $words as $k => $v )
{
foreach( $words as $k => $v )
if ( ! $noClean )
{
$words[ $k ] = $this->cleanMessage( $v );
$ptWords[ $k ] = $this->cleanMessage( $v );
}
$htmlWords[ $k ] = $v;
}
$this->_words = $words;
$this->_words = $ptWords;
$this->plainTextTemplate = preg_replace_callback( "/<#(.+?)#>/", array( &$this, '_swapWords' ), $this->plainTextTemplate );
$this->message = preg_replace_callback( "/<#(.+?)#>/", array( &$this, '_swapWords' ), $this->message );
$this->subject = preg_replace_callback( "/<#(.+?)#>/", array( &$this, '_swapWords' ), $this->subject );
$this->_words = $htmlWords;
$this->htmlTemplate = preg_replace_callback( "/<#(.+?)#>/", array( &$this, '_swapWords' ), str_replace( array( '&lt;#', '#&gt;' ), array( '<#', '#>' ), $this->htmlTemplate ) );
$this->_words = array();
$this->subject = preg_replace_callback( "/<#(.+?)#>/", array( &$this, '_swapWords' ), $this->subject );
$this->_words = array();
/* Final touches */
$this->htmlTemplate = $this->applyHtmlWrapper( $this->subject, ( $rawHtml ? $this->htmlTemplate : $this->convertTextEmailToHtmlEmail( $this->htmlTemplate ) ) );
$this->htmlTemplate = preg_replace( '#<!--hook\.([^\>]+?)-->#', '', $this->htmlTemplate );
$this->htmlTemplate = $this->registry->getClass('output')->parseIPSTags( $this->htmlTemplate );
$this->plainTextTemplate = stripslashes($this->lang->words['email_header']) . $this->plainTextTemplate . stripslashes($this->lang->words['email_footer']);
/* Some older apps use $this->message, so give them plaintext */
$this->message = $this->plainTextTemplate;
}
/**
* Convert text email to HTML
* Pretty nifty method name too.
*
* @param string Plain text email ready to go
* @return string We're all HTML'd up in here.
*/
public function convertTextEmailToHtmlEmail( $content )
{
if ( strstr( $content, '[' ) OR strstr( $content, "\n" ) )
{
/* It's probably HITMAL! */
if ( ! is_object( $this->editor ) )
{
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
$this->editor = new $classToLoad();
/* Reset HTML flags */
$this->editor->setAllowHtml(false);
}
IPSText::getTextClass('bbcode')->parse_html = 0;
$content = IPSText::getTextClass('bbcode')->preDisplayParse( $this->editor->switchContent( $content, false ) );
/* Switch content makes & &amp; so we need to switch this back */
$content = str_replace( '&amp;', '&', $content );
/* Other stuffs */
$content = preg_replace( '#(\-{10,120})#', '<hr>', $content );
}
return $content;
}
/**
* Add <html> tags and such if it doesn't have any already
*
* @param string HTML email
* @return string VERY HTML email
*/
public function applyHtmlWrapper( $subject, $content )
{
/* Due to some legacy methods with mail queue, buildMessage can be called twice
* for good reason, but it can then re-apply the wrapper. So we add a unique comment
* and then check for this.
*/
if ( ! stristr( $content, '<!--::ipb.wrapper.added::-->' ) )
{
$content = '<!--::ipb.wrapper.added::-->' . IPSText::getTextClass('bbcode')->xssHtmlClean( $content );
/* Inline wrapper */
if ( $this->htmlWrapper )
{
return str_ireplace( '<#content#>', $content, $this->htmlWrapper );
}
/* Attempt to load external wrapper */
if ( file_exists( IPS_CACHE_PATH . 'cache/skin_cache/emailWrapper.php' ) )
{
if ( ! is_object( $this->_loadedHtmlTemplateClass ) )
{
$classToLoad = IPSLib::loadLibrary( IPS_CACHE_PATH . 'cache/skin_cache/emailWrapper.php', 'ipsEmailWrapper' );
$this->_loadedHtmlTemplateClass = new $classToLoad();
}
return $this->_loadedHtmlTemplateClass->getTemplate( $content );
}
/* Still here? Fail safe */
return $this->parseWithDefaultHtmlWrapper( $content );
}
return $content;
}
/**
@@ -366,7 +626,7 @@ class hanEmail
* @param string Key
* @return string Replaced variable
*/
private function _swapWords( $matches )
protected function _swapWords( $matches )
{
return $this->_words[ $matches[1] ];
}
@@ -377,7 +637,7 @@ class hanEmail
* @param string In text
* @return string Out text
*/
private function _cleanSubject( $subject )
protected function _cleanSubject( $subject )
{
$subject = strip_tags( $subject );
@@ -392,6 +652,7 @@ class hanEmail
$subject = str_replace( "&#93;" , "]" , $subject );
$subject = str_replace( "&#064;", '@' , $subject );
$subject = str_replace( "&nbsp;" , ' ', $subject );
$subject = str_replace( "&amp;" , '&', $subject );
return $subject;
}
@@ -404,7 +665,7 @@ class hanEmail
*/
public function cleanMessage( $message = "" )
{
$message = preg_replace( '#\[quote.*\](.+?)\[/quote\]#s', "<br /><br />------------ QUOTE ----------<br />\\1<br />-----------------------------<br /><br />" , $message );
$message = preg_replace( '#\[quote(?:[^\]]+?)?\](.+?)\[/quote\]#s', "<br /><br />------------ QUOTE ----------<br />\\1<br />-----------------------------<br /><br />" , $message );
$message = preg_replace_callback( '#\[url=(.+?)\](.+?)\[/url\]#', array( $this, "_formatUrl" ), $message );
@@ -412,7 +673,7 @@ class hanEmail
// Unconvert smilies 'cos at this point they are img tags
//-----------------------------------------
$message = IPSText::getTextClass('bbcode')->unconvertSmilies( $message );
$message = IPSText::unconvertSmilies( $message );
//-----------------------------------------
// We may want to adjust this later, but for
@@ -424,9 +685,8 @@ class hanEmail
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 0;
IPSText::getTextClass( 'bbcode' )->parse_wordwrap = -1;
$message = IPSText::getTextClass('bbcode')->stripAllTags( $message, true, false );
$message = IPSText::getTextClass('bbcode')->stripAllTags( $message, true );
//-----------------------------------------
// Bear with me...
@@ -481,7 +741,7 @@ class hanEmail
* @param string File data
* @param string File name
* @param string File type (MIME)
* @return void
* @return @e void
*/
public function addAttachment( $data="", $name="", $ctype='application/octet-stream' )
{
@@ -495,7 +755,7 @@ class hanEmail
* @param string Help key (deprecated)
* @return bool
*/
private function fatalError( $msg, $help="" )
protected function fatalError( $msg, $help="" )
{
$this->DB->insert( 'mail_error_logs',
array(
@@ -511,5 +771,40 @@ class hanEmail
);
return false;
}
}
/**
* Default wrapper for HTML emails - edit the one in skin_global_other
*
* @param string HTML content
* @return string HTML email done
*/
protected function parseWithDefaultHtmlWrapper( $content )
{
$doc =IPS_DOC_CHAR_SET;
$email = <<<HTML
<html>
<head>
<meta content="text/html; charset={$doc}" http-equiv="Content-Type">
<title><#subject#></title>
<style type="text/css">
* {
font-family: Arial;
font-size: 14px;
color: #000;
background: #fff;
line-height: 140%;
}
</style>
</head>
<body>
{$content}
</body>
</head>
</html>
HTML;
return $email;
}
}
+59 -63
View File
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Login handler abstraction
* Last Updated: $Date: 2010-11-12 13:07:33 -0500 (Fri, 12 Nov 2010) $
* Last Updated: $Date: 2011-09-16 17:49:58 -0400 (Fri, 16 Sep 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 7174 $
* @version $Revision: 9505 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -39,7 +39,7 @@ class han_login
*
* @var array
*/
private $modules = array();
protected $modules = array();
/**
* Flag :: ACP Login
@@ -94,7 +94,7 @@ class han_login
* Constructor
*
* @param object ipsRegistry reference
* @return void
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
@@ -162,7 +162,7 @@ class han_login
$_sticky = $_time ? 0 : 1;
$_days = $_time ? $this->settings['login_key_expire'] : 365;
if ( $this->settings['login_change_key'] OR !$member['member_login_key'] OR ( $this->settings['login_key_expire'] AND ( time() > $member['member_login_key_expire'] ) ) )
if ( !$member['member_login_key'] OR ( $this->settings['login_key_expire'] AND ( time() > $member['member_login_key_expire'] ) ) )
{
$member['member_login_key'] = IPSMember::generateAutoLoginKey();
@@ -217,7 +217,7 @@ class han_login
'login_type' => $privacy ) );
if ( isset( $this->request['referer'] ) AND $this->request['referer'] AND $this->request['section'] != 'register' )
if ( !empty( $this->request['referer'] ) AND $this->request['section'] != 'register' )
{
if ( stripos( $this->request['referer'], 'section=register' ) OR stripos( $this->request['referer'], 'section=login' ) OR stripos( $this->request['referer'], 'section=lostpass' ) )
{
@@ -256,6 +256,12 @@ class han_login
$this->DB->delete( 'validating', 'member_id=' . $this->registry->member()->getProperty('member_id') . ' AND lost_pass=1' );
//-----------------------------------------
// Run member sync
//-----------------------------------------
IPSLib::runMemberSync( 'onLogin', $member );
//-----------------------------------------
// Redirect them to either the board
// index, or where they came from
@@ -275,9 +281,6 @@ class han_login
// Still here?
//-----------------------------------------
/* Member Sync */
IPSLib::runMemberSync( 'onLogin', $member );
return array( $this->registry->getClass('class_localization')->words['partial_login'], str_replace( '?&', '?', $url . '&s=' . $session_id ) );
}
@@ -292,7 +295,7 @@ class han_login
$member = array();
$username = '';
$email = '';
$password = trim( $this->request['password'] );
$password = trim( $this->request['ips_password'] );
$errors = '';
$core = array();
@@ -300,13 +303,13 @@ class han_login
// Is this a username or email address?
//-----------------------------------------
if( IPSText::checkEmailAddress( $this->request['username'] ) )
if( IPSText::checkEmailAddress( $this->request['ips_username'] ) )
{
$email = $this->request['username'];
$email = $this->request['ips_username'];
}
else
{
$username = $this->request['username'];
$username = $this->request['ips_username'];
}
//-----------------------------------------
@@ -347,6 +350,10 @@ class han_login
{
return array( null, null, 'wrong_openid' );
}
else if( $this->return_code == 'MISSING_EXTENSIONS' )
{
return array( null, null, 'missing_extensions' );
}
else if( $this->return_code == 'FLAGGED_REMOTE' )
{
return array( null, null, 'flagged_remote' );
@@ -376,7 +383,7 @@ class han_login
$_sticky = $_time ? 0 : 1;
$_days = $_time ? $this->settings['login_key_expire'] : 365;
if ( $this->settings['login_change_key'] OR !$member['member_login_key'] OR ( $this->settings['login_key_expire'] AND ( time() > $member['member_login_key_expire'] ) ) )
if ( !$member['member_login_key'] OR ( $this->settings['login_key_expire'] AND ( time() > $member['member_login_key_expire'] ) ) )
{
$member['member_login_key'] = IPSMember::generateAutoLoginKey();
@@ -418,7 +425,7 @@ class han_login
// Create / Update session
//-----------------------------------------
$privacy = $this->request['anonymous'] ? 1 : 0;
$privacy = ( !$this->settings['disable_anonymous'] AND $this->request['anonymous'] ) ? 1 : 0;
if( $member['g_hide_online_list'] )
{
@@ -431,7 +438,7 @@ class han_login
'login_type' => $privacy ) );
if ( $this->request['referer'] AND $this->request['referer'] AND $this->request['section'] != 'register' )
if ( !empty($this->request['referer']) AND $this->request['section'] != 'register' )
{
if ( stripos( $this->request['referer'], 'section=register' ) OR stripos( $this->request['referer'], 'section=login' ) OR stripos( $this->request['referer'], 'section=lostpass' ) OR stripos( $this->request['referer'], CP_DIRECTORY . '/' ) )
{
@@ -468,6 +475,16 @@ class han_login
$this->DB->delete( 'validating', 'member_id=' . $this->registry->member()->getProperty('member_id') . ' AND lost_pass=1' );
//-----------------------------------------
// Run member sync
//-----------------------------------------
$member['plainPassword'] = $password;
IPSLib::runMemberSync( 'onLogin', $member );
unset( $member['plainPassword'] );
//-----------------------------------------
// Redirect them to either the board
// index, or where they came from
@@ -486,13 +503,6 @@ class han_login
//-----------------------------------------
// Still here?
//-----------------------------------------
$member['plainPassword'] = $password;
/* Member Sync */
IPSLib::runMemberSync( 'onLogin', $member );
unset( $member['plainPassword'] );
return array( $this->registry->getClass('class_localization')->words['partial_login'], $url );
}
@@ -500,7 +510,7 @@ class han_login
/**
* Initialize class
*
* @return void
* @return @e void
*/
public function init()
{
@@ -508,8 +518,8 @@ class han_login
// INIT
//-----------------------------------------
require_once( IPS_PATH_CUSTOM_LOGIN . '/login_core.php' );
require_once( IPS_PATH_CUSTOM_LOGIN . '/login_interface.php' );
require_once( IPS_PATH_CUSTOM_LOGIN . '/login_core.php' );/*noLibHook*/
require_once( IPS_PATH_CUSTOM_LOGIN . '/login_interface.php' );/*noLibHook*/
$classes = array();
$configs = array();
@@ -527,21 +537,12 @@ class han_login
{
if( $login_method['login_enabled'] )
{
if( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php' ) )
if( is_file( IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php' ) )
{
$classes[ $login_method['login_order'] ] = IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php';
$configs[ $login_method['login_order'] ] = IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/conf.php';
$this->login_methods[ $login_method['login_order'] ] = $login_method;
$this->login_confs[ $login_method['login_order'] ] = array();
if( file_exists( $configs[ $login_method['login_order'] ] ) )
{
$LOGIN_CONF = array();
require( $configs[ $login_method['login_order'] ] );
$this->login_confs[ $login_method['login_order'] ] = $LOGIN_CONF;
}
$this->login_confs[ $login_method['login_order'] ] = $login_method['login_custom_config'] ? @unserialize( $login_method['login_custom_config'] ) : array();
$classname = IPSLib::loadLibrary( $classes[ $login_method['login_order'] ], 'login_' . $login_method['login_folder_name'] );
$this->modules[ $login_method['login_order'] ] = new $classname( $this->registry, $login_method, $this->login_confs[ $login_method['login_order'] ] );
}
@@ -560,24 +561,14 @@ class han_login
while( $login_method = $this->DB->fetch() )
{
if( file_exists( IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php' ) )
if( is_file( IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php' ) )
{
$classes[ $login_method['login_order'] ] = IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php';
$configs[ $login_method['login_order'] ] = IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/conf.php';
$this->login_methods[ $login_method['login_order'] ] = $login_method;
$this->login_confs[ $login_method['login_order'] ] = $login_method['login_custom_config'] ? @unserialize( $login_method['login_custom_config'] ) : array();
if( file_exists( $configs[ $login_method['login_order'] ] ) )
{
$LOGIN_CONF = array();
require( $configs[ $login_method['login_order'] ] );
$this->login_confs[ $login_method['login_order'] ] = $LOGIN_CONF;
}
$classname = "login_" . $login_method['login_folder_name'];
require_once( $classes[ $login_method['login_order'] ] );
$this->modules[ $login_method['login_order'] ] = new $classname( $this->registry, $login_method, $this->login_confs[ $login_method['login_order'] ] );
$classToLoad = IPSLib::loadLibrary( $classes[ $login_method['login_order'] ], 'login_' . $login_method['login_folder_name'] );
$this->modules[ $login_method['login_order'] ] = new $classToLoad( $this->registry, $login_method, $this->login_confs[ $login_method['login_order'] ] );
}
}
}
@@ -595,10 +586,9 @@ class han_login
$classes[ 0 ] = IPS_PATH_CUSTOM_LOGIN . '/internal/auth.php';
$this->login_methods[ 0 ] = $login_method;
$this->login_confs[ 0 ] = array();
$classname = "login_internal";
require_once( $classes[ 0 ] );
$this->modules[ 0 ] = new $classname( $this->registry, $login_method, array() );
$classToLoad = IPSLib::loadLibrary( $classes[ 0 ], 'login_internal' );
$this->modules[ 0 ] = new $classToLoad( $this->registry, $login_method, array() );
}
}
@@ -853,14 +843,14 @@ class han_login
$obj_reference->nameExistsCheck( $nameToCheck, $memberData, $fieldToCheck );
$this->return_code = $obj_reference->return_code;
if( $this->return_code AND !in_array( $this->return_code, array( 'NAME_NOT_IN_USE', 'METHOD_NOT_DEFINED', 'WRONG_AUTH', 'WRONG_OPENID' ) ) )
if( $this->return_code AND !in_array( $this->return_code, array( 'NAME_NOT_IN_USE', 'METHOD_NOT_DEFINED', 'WRONG_AUTH', 'WRONG_OPENID', 'MISSING_EXTENSIONS' ) ) )
{
break;
}
}
}
if( $this->return_code AND !in_array( $this->return_code, array( 'NAME_NOT_IN_USE', 'METHOD_NOT_DEFINED', 'WRONG_AUTH', 'WRONG_OPENID' ) ) )
if( $this->return_code AND !in_array( $this->return_code, array( 'NAME_NOT_IN_USE', 'METHOD_NOT_DEFINED', 'WRONG_AUTH', 'WRONG_OPENID', 'MISSING_EXTENSIONS' ) ) )
{
return true;
}
@@ -887,14 +877,14 @@ class han_login
$obj_reference->emailExistsCheck( $email );
$this->return_code = $obj_reference->return_code;
if( $this->return_code AND !in_array( $this->return_code, array( 'EMAIL_NOT_IN_USE', 'METHOD_NOT_DEFINED', 'WRONG_AUTH', 'WRONG_OPENID' ) ) )
if( $this->return_code AND !in_array( $this->return_code, array( 'EMAIL_NOT_IN_USE', 'METHOD_NOT_DEFINED', 'WRONG_AUTH', 'WRONG_OPENID', 'MISSING_EXTENSIONS' ) ) )
{
break;
}
}
}
if( $this->return_code AND !in_array( $this->return_code, array( 'EMAIL_NOT_IN_USE', 'METHOD_NOT_DEFINED', 'WRONG_AUTH', 'WRONG_OPENID' ) ) )
if( $this->return_code AND !in_array( $this->return_code, array( 'EMAIL_NOT_IN_USE', 'METHOD_NOT_DEFINED', 'WRONG_AUTH', 'WRONG_OPENID', 'MISSING_EXTENSIONS' ) ) )
{
return true;
}
@@ -1016,6 +1006,12 @@ class han_login
foreach( $this->login_methods as $k => $method )
{
/* @link http://community.invisionpower.com/tracker/issue-27425-misleading-enter-username-or-email-text */
if( in_array( $method['login_folder_name'], array( 'openid', 'live' ) ) )
{
continue;
}
if( $method['login_user_id'] == 'either' )
{
$username = true;
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* BBCode parsing gateway.
* Last Updated: $Date: 2010-11-12 13:07:33 -0500 (Fri, 12 Nov 2010) $
* Last Updated: $Date: 2011-06-07 18:56:57 -0400 (Tue, 07 Jun 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since 9th March 2005 11:03
* @version $Revision: 7174 $
* @version $Revision: 8999 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -82,13 +82,6 @@ class parseBbcode
* @var boolean
*/
public $parse_nl2br = true;
/**
* Parse wordwrap
*
* @var boolean
*/
public $parse_wordwrap = 0;
/**
* Bypass badwords?
@@ -151,7 +144,7 @@ class parseBbcode
*
* @param object Registry object
* @param string Parsing method to use
* @return void
* @return @e void
*/
public function __construct( ipsRegistry $registry, $method='normal' )
{
@@ -174,46 +167,27 @@ class parseBbcode
/* And some default properties */
$this->bypass_badwords = $this->memberData ? intval( $this->memberData['g_bypass_badwords'] ) : 0;
$this->strip_quotes = $this->settings['strip_quotes'];
$this->parse_wordwrap = $this->settings['post_wordwrap'];
}
/**
* Load the required bbcode classes and initialize the object
*
* @return void
* @todo Needs the new library hook call when implemented
* @todo Remove that swith and just check for 'if legacy' => load the other file and change class
* @return @e void
*/
private function _loadClasses()
protected function _loadClasses()
{
$_NOW = IPSDebug::getMemoryDebugFlag();
if ( ! $this->classes_loaded )
{
$_NOW = IPSDebug::getMemoryDebugFlag();
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/bbcode/core.php', 'class_bbcode_core' );
IPSDebug::setMemoryDebugFlag( "Require once call for core.php", $_NOW );
switch( $this->pre_edit_parse_method )
if( $this->pre_edit_parse_method == 'legacy' )
{
case 'legacy':
$file = 'legacy.php';
$class = 'class_bbcode_legacy';
break;
default:
$file = '';//'normal.php';
$class = $classToLoad;
break;
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/bbcode/legacy.php', 'class_bbcode_legacy' );
}
if( $file )
{
require_once ( IPS_ROOT_PATH . 'sources/classes/bbcode/' . $file );
}
$this->bbclass = new $class( $this->registry );
$this->bbclass = new $classToLoad( $this->registry );
$this->classes_loaded = true;
$this->error =& $this->bbclass->error;
$this->warning =& $this->bbclass->warning;
@@ -225,10 +199,13 @@ class parseBbcode
/**
* Pass off our settings to our bbcode handler
*
* @return void
* @return @e void
*/
private function _passSettings()
protected function _passSettings()
{
/* Clean out secondary groups just in case of ,, */
$this->parsing_mgroup_others = IPSText::cleanPermString( $this->parsing_mgroup_others );
//-----------------------------------------
// Pass the settings
//-----------------------------------------
@@ -241,7 +218,6 @@ class parseBbcode
$this->bbclass->parse_bbcode = $this->parse_bbcode;
$this->bbclass->strip_quotes = $this->strip_quotes;
$this->bbclass->parse_nl2br = $this->parse_nl2br;
$this->bbclass->parse_wordwrap = $this->parse_wordwrap;
$this->bbclass->parsing_section = $this->parsing_section;
$this->bbclass->parsing_mgroup = $this->parsing_mgroup;
$this->bbclass->parsing_mgroup_others = $this->parsing_mgroup_others;
@@ -304,7 +280,7 @@ class parseBbcode
$text = $this->bbclass->preDisplayParse( $text );
IPSDebug::setMemoryDebugFlag( "PreDisplayParse completed", $_NOW );
return $text;
}
@@ -317,11 +293,8 @@ class parseBbcode
*/
public function parsePollTags( $text )
{
if( $this->settings['poll_tags'] )
{
$text = $this->bbclass->parseBbcode( $text, 'display', array( 'img', 'url' ) );
$text = $this->bbclass->finishNonParsed( $text, 'display' );
}
$text = $this->bbclass->parseBbcode( $text, 'display', array( 'img', 'url' ) );
$text = $this->bbclass->finishNonParsed( $text, 'display' );
return $text;
}
@@ -388,14 +361,13 @@ class parseBbcode
*
* @param string BBCode + HTML text
* @param boolean Run through pre_edit_parse
* @param boolean Check "strip from search" option
* @return string Raw text with no tags
*/
public function stripAllTags( $t, $pre_edit_parse=true, $only_search=true )
public function stripAllTags( $t, $pre_edit_parse=true )
{
$this->_passSettings();
return $this->bbclass->stripAllTags( $t, $pre_edit_parse, $only_search );
return $this->bbclass->stripAllTags( $t, $pre_edit_parse );
}
/**
@@ -411,6 +383,19 @@ class parseBbcode
return $this->bbclass->stripBbcode( 'quote', $t );
}
/**
* Strip shared media
*
* @param string Raw posted text
* @return string Raw text with no shared media
*/
public function stripSharedMedia( $t )
{
$t = preg_replace( "#\[sharedmedia=([^\]]+?)\]#is", " ", $t );
return $t;
}
/**
* Strip emoticons
*
@@ -432,9 +417,7 @@ class parseBbcode
*/
public function unconvertSmilies( $t )
{
$this->_passSettings();
return $this->bbclass->unconvertSmilies( $t );
return IPSText::unconvertSmilies( $t );
}
/**
@@ -462,22 +445,6 @@ class parseBbcode
return $this->bbclass->checkBlacklistUrls( $t );
}
/**
* Apply word wrapping
*
* @param string BBCode + HTML text
* @param integer Number of characters to wrap after
* @param string Break string
* @return string Raw text with no tags
*/
public function wordWrap( $t, $chars=80, $break="\n" )
{
$this->parse_wordwrap = $chars;
$this->_passSettings();
return $this->bbclass->applyWordwrap( $t, $chars, $break );
}
/**
* Make data in quotes "safe"
@@ -505,16 +472,4 @@ class parseBbcode
return $this->bbclass->checkXss( $t, $fixScript );
}
/**
* Determines if member is viewing images
* If not, unparses smilies
*
* @param string Raw input text to parse
* @return string Parsed text ready to be stored in database
*/
public function memberViewImages( $text )
{
return IPSLib::memberViewImages( $text );
}
}
+1 -1
View File
@@ -5,6 +5,6 @@
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionboard.com/">IP.Board</a>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>