Version 3.4.5

This commit is contained in:
Neo committed 2025-12-19 00:38:12 -08:00
1 parent fb6b5baabc
commit e4478369d8
1360 files changed
+228921 -179445

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,370 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Attachments Controller
* Last Updated: $Date: 2012-06-29 15:12:14 +0100 (Fri, 29 Jun 2012) $
* By: Matt Mecham
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
* @version $Rev: 11007 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class classes_attach_controller
{
/**#@+
* Registry Object Shortcuts
*
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
/**#@-*/
/**
* Attachment Library
*
* @var object class_attach
*/
public $class_attach;
/**
* AJAX Library
*
* @var object classAjax
*/
public $ajax;
/**
* CONSTRUCTOR
*
* @param object ipsRegistry reference
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
/* Make object */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
/* AJAX Class */
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
$this->ajax = new $classToLoad();
/* Attachment Class */
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
$this->class_attach = new $classToLoad( $registry );
}
/**
* Run the controller
* @param string Key
*/
public function run( $do )
{
switch( $do )
{
case 'attach_upload_show':
$this->attachmentUploadShowAsJson();
break;
case 'attach_upload_process':
$this->attachmentUploadProcess();
break;
case 'attach_upload_remove':
$this->attachmentUploadRemove();
break;
/* IFrame based upload */
case 'attachiFrame':
$this->attachiFrame();
break;
case 'attachUploadiFrame':
$this->attachUploadiFrame();
break;
default:
$this->showPostAttachment();
break;
}
}
/**
* View Post Attachment
*
* @return @e void
*/
public function showPostAttachment()
{
/* INIT */
$attach_id = intval( $this->request['attach_id'] );
/* INIT module */
$this->class_attach->init();
/* Display */
$this->class_attach->showAttachment( $attach_id );
}
/**
* Remove an upload
*
* @return @e void
*/
public function attachmentUploadRemove()
{
/* INIT */
$attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
$attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
$attach_rel_id = intval( $this->request['attach_rel_id'] );
$attach_id = intval( $this->request['attach_id'] );
/* Setup Module */
$this->class_attach->type = $attach_rel_module;
$this->class_attach->attach_post_key = $attach_post_key;
$this->class_attach->attach_rel_id = $attach_rel_id;
$this->class_attach->attach_id = $attach_id;
$this->class_attach->init();
/* Remove the attachment */
$removed = $this->class_attach->removeAttachment();
/* Show the form */
if( $removed )
{
$this->ajax->returnHtml( $this->attachmentUploadShow( 'attach_removed', 0 ) );
}
else
{
$this->ajax->returnHtml( $this->attachmentUploadShow( 'remove_failed', 1 ) );
}
}
/**
* Perform the actual upload
*
* @return @e void
*/
public function attachmentUploadProcess()
{
/* INIT */
$attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
$attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
$attach_rel_id = intval( $this->request['attach_rel_id'] );
$attach_current_items = '';
/* INIT module */
$this->class_attach->type = $attach_rel_module;
$this->class_attach->attach_post_key = $attach_post_key;
$this->class_attach->attach_rel_id = $attach_rel_id;
$this->class_attach->init();
/* Process upload */
$insert_id = $this->class_attach->processUpload();
/* Got an error? */
if( $this->class_attach->error )
{
$this->ajax->returnHtml( $this->attachmentUploadShow( $this->class_attach->error, 1, $insert_id ) );
}
else
{
$this->ajax->returnHtml( $this->attachmentUploadShow( 'upload_ok', 0, $insert_id ) );
}
}
/**
* Show the attach upload field as ajax HTML
*
* @param string $msg
* @param bool $is_error
* @param integer $insert_id
* @return @e void
*/
public function attachmentUploadShowAsJson()
{
$this->ajax->returnHtml( $this->attachmentUploadShow() );
}
/**
* Show the attach upload field
*
* @param string $msg
* @param bool $is_error
* @param integer $insert_id
* @return @e void
*/
public function attachmentUploadShow( $msg="ready", $is_error=0, $insert_id=0 )
{
/* INIT JSON */
$JSON = array();
$JSON['msg'] = $msg;
$JSON['is_error'] = $is_error;
$is_reset = 0;
/* JSON Data */
$JSON['attach_post_key'] = $attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
$JSON['attach_rel_module'] = $attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
$JSON['attach_rel_id'] = $attach_rel_id = intval( $this->request['attach_rel_id'] );
if( $insert_id )
{
$JSON['insert_id'] = $insert_id;
}
/* Get extra form fields */
foreach( $this->request as $k => $v )
{
if( preg_match( "#^--ff--#", $k ) )
{
$JSON['extra_upload_form_url'] .= '&amp;' . str_replace( '--ff--', '', $k ) . '='.$v;
$JSON['extra_upload_form_url'] .= '&amp;' . $k . '='.$v;
}
}
/* INIT module */
$this->class_attach->type = $attach_rel_module;
$this->class_attach->attach_post_key = $attach_post_key;
$this->class_attach->init();
$this->class_attach->getUploadFormSettings();
/* Load Language Bits */
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'lang_post' ) );
/* Generate current items... */
$_more = ( $attach_rel_id ) ? ' OR c.attach_rel_id=' . $attach_rel_id : '';
$this->DB->build( array(
'select' => 'c.*',
'from' => array( 'attachments' => 'c' ),
'where' => "c.attach_rel_module='{$attach_rel_module}' AND c.attach_post_key='{$attach_post_key}'{$_more}",
'add_join' => array( array(
'select' => 't.*',
'from' => array( 'attachments_type' => 't' ),
'where' => 't.atype_extension=c.attach_ext',
'type' => 'left'
) )
) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
if ( $attach_rel_module != $row['attach_rel_module'] )
{
continue;
}
if( ( $insert_id && $row['attach_id'] == $insert_id ) || $this->request['fetch_all'] )
{
if ( $row['attach_is_image'] and ! $row['attach_thumb_location'] )
{
$row['attach_thumb_location'] = $row['attach_location'];
$row['attach_thumb_width'] = $row['attach_width'];
$row['attach_thumb_height'] = $row['attach_height'];
}
$JSON['current_items'][ $row['attach_id'] ] = array( $row['attach_id'] ,
str_replace( array( '[', ']' ), '', $row['attach_file'] ),
$row['attach_filesize'],
$row['attach_is_image'],
$row['attach_thumb_location'],
$row['attach_thumb_width'],
$row['attach_thumb_height'],
$row['atype_img']
);
}
}
$JSON['attach_stats'] = $this->class_attach->attach_stats;
/* Formatting nonsense for special char sets */
$result = IPSText::jsonEncodeForTemplate( $JSON );
IPSDebug::addLogMessage( $result, 'uploads' );
/* Return JSON */
return $result;
}
/**
* Show the attach upload field
*
* @param string $msg
* @param bool $is_error
* @param integer $insert_id
* @return @e void
*/
public function attachiFrame( $msg="ready", $is_error=0, $insert_id=0 )
{
/* INIT JSON */
$JSON = $this->attachmentUploadShow( $msg, $is_error, $insert_id );
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_post' ), 'forums' );
$this->ajax->returnHtml( $this->registry->output->getTemplate( 'post' )->attachiFrame( $JSON, intval( $this->request['attach_rel_id'] ) ) );
}
/**
* Perform the actual upload
*
* @return @e void
*/
public function attachUploadiFrame()
{
/* INIT */
$attach_post_key = trim( IPSText::alphanumericalClean( $this->request['attach_post_key'] ) );
$attach_rel_module = trim( IPSText::alphanumericalClean( $this->request['attach_rel_module'] ) );
$attach_rel_id = intval( $this->request['attach_rel_id'] );
$attach_current_items = '';
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_post' ), 'forums' );
/* INIT module */
$this->class_attach->type = $attach_rel_module;
$this->class_attach->attach_post_key = $attach_post_key;
$this->class_attach->attach_rel_id = $attach_rel_id;
$this->class_attach->init();
/* Process upload */
$insert_id = $this->class_attach->processUpload();
/* Got an error? */
if( $this->class_attach->error )
{
$JSON = $this->attachmentUploadShow( $this->class_attach->error, 1, $insert_id );
}
else
{
$JSON = $this->attachmentUploadShow( 'upload_ok', 0, $insert_id );
}
$this->ajax->returnHtml( $this->registry->output->getTemplate( 'post' )->attachiFrame( $JSON, $attach_rel_id ) );
}
}
@@ -2,10 +2,10 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Subscriptions Hooks Gateway "Handler"
* Owner: Matt "Oh Lord, why did I get assigned this?" Mecham
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
@@ -14,7 +14,7 @@
* @package IP.Board
* @link http://www.invisionpower.com
* @since 9th March 2005 11:03
* @version $Revision: 10914 $
* @version $Revision: 10721 $
*/
class core_hookGateway
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Library of shared methods for hooks installation/configuration
* Last Updated: $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $LastChangedDate: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -2,19 +2,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Library for reported content
* Last Updated: $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $LastChangedDate: 2012-11-14 18:17:25 -0500 (Wed, 14 Nov 2012) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: AndyMillne $
* @author Based on original "Report Center" by Luke Scott
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 11604 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -309,7 +309,7 @@ class reportLibrary
$cids[ $row['com_id'] ] = $spec_perm;
}
}
return $this->DB->fetchLoadedClass('report_sql_queries')->join_com_permissions( array( 'NOTCACHE' => 1, 'COMS' => $cids ) );
}
@@ -428,7 +428,13 @@ class reportLibrary
}
}
return $this->registry->getClass('output')->getTemplate('reports')->basicReportForm( $name, $url, $extra_input );
/* CAPTCHA */
if ( ! $this->memberData['member_id'] AND $this->settings['guest_captcha'] AND $this->settings['bot_antispam_type'] != 'none' )
{
$captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
}
return $this->registry->getClass('output')->getTemplate('reports')->basicReportForm( $name, $url, $extra_input, $captchaHTML );
}
/**
@@ -2,19 +2,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Notifications class for reported content
* Last Updated: $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $LastChangedDate: 2013-02-19 15:55:32 -0500 (Tue, 19 Feb 2013) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: AndyMillne $
* @author Based on original "Report Center" by Luke Scott
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 12002 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -123,6 +123,17 @@ class reportNotifications
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
$notifyLibrary = new $classToLoad( $this->registry );
IPSText::getTextClass( 'email' )->getTemplate( "report_reply", $user['language'] );
IPSText::getTextClass( 'email' )->buildMessage( array(
'MOD_NAME' => '#member_name#',
'COMMENTER' => $this->memberData['members_display_name'],
'LINK' => $this->registry->getClass('reportLibrary')->processUrl( $this->my_report_data['SAVED_URL'], $this->my_report_data['SEOTITLE'], $this->my_report_data['TEMPLATE'] ),
'REPORTLINK'=> $this->settings['base_url'] . 'app=core&module=reports&do=show_report&rid=' . $this->my_report_data['REPORT_INDEX'],
'COMMENT' => $postContent,
)
);
$_memberIds = array();
foreach( $this->my_data as $_data )
@@ -145,16 +156,7 @@ class reportNotifications
$user = array_merge( $user, $_memberData[ $user['member_id'] ] );
IPSText::getTextClass( 'email' )->getTemplate( "report_reply", $user['language'] );
IPSText::getTextClass( 'email' )->buildMessage( array(
'MOD_NAME' => $user['members_display_name'],
'COMMENTER' => $this->memberData['members_display_name'],
'LINK' => $this->registry->getClass('reportLibrary')->processUrl( $this->my_report_data['SAVED_URL'], $this->my_report_data['SEOTITLE'], $this->my_report_data['TEMPLATE'] ),
'REPORTLINK'=> $this->settings['base_url'] . 'app=core&module=reports&do=show_report&rid=' . $this->my_report_data['REPORT_INDEX'],
'COMMENT' => $postContent,
)
);
$_subject = sprintf(
$this->lang->words['subject_reportreply'],
@@ -167,7 +169,7 @@ class reportNotifications
$notifyLibrary->setFrom( $this->memberData );
$notifyLibrary->setNotificationKey( 'report_center' );
$notifyLibrary->setNotificationUrl( $this->settings['base_url'] . 'app=core&module=reports&do=show_report&rid=' . $this->my_report_data['REPORT_INDEX'] );
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
$notifyLibrary->setNotificationText( str_replace( '#member_name#', $user['members_display_name'], IPSText::getTextClass('email')->message ) );
$notifyLibrary->setNotificationTitle( $_subject );
try
@@ -191,6 +193,17 @@ class reportNotifications
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
$notifyLibrary = new $classToLoad( $this->registry );
IPSText::getTextClass('email')->getTemplate( "report_emailpm", $user['language'], 'public_reports', 'core' );
IPSText::getTextClass('email')->buildMessage( array(
'MOD_NAME' => '#member_name#',
'USERNAME' => $this->memberData['members_display_name'],
'LINK' => $this->registry->getClass('reportLibrary')->processUrl( $this->my_report_data['SAVED_URL'], $this->my_report_data['SEOTITLE'], $this->my_report_data['TEMPLATE'] ),
'REPORTLINK'=> $this->settings['base_url'] . 'app=core&module=reports&do=show_report&rid=' . $this->my_report_data['REPORT_INDEX'],
'REPORT' => $this->my_report_data['REPORT'],
)
);
$_memberIds = array();
foreach( $this->my_data as $_data )
@@ -213,30 +226,29 @@ class reportNotifications
$user = array_merge( $user, $_memberData[ $user['member_id'] ] );
IPSText::getTextClass('email')->getTemplate( "report_emailpm", $user['language'], 'public_reports', 'core' );
IPSText::getTextClass('email')->buildMessage( array(
'MOD_NAME' => $user['members_display_name'],
'USERNAME' => $this->memberData['members_display_name'],
'LINK' => $this->registry->getClass('reportLibrary')->processUrl( $this->my_report_data['SAVED_URL'], $this->my_report_data['SEOTITLE'], $this->my_report_data['TEMPLATE'] ),
'REPORTLINK'=> $this->settings['base_url'] . 'app=core&module=reports&do=show_report&rid=' . $this->my_report_data['REPORT_INDEX'],
'REPORT' => $this->my_report_data['REPORT'],
)
);
$_subject = sprintf(
$this->lang->words['subject_report'],
$this->registry->output->buildSEOUrl( 'showuser=' . $this->memberData['member_id'], 'public', $this->memberData['members_seo_name'], 'showuser' ),
$this->memberData['members_display_name'],
$this->settings['base_url'] . 'app=core&module=reports&do=show_report&rid=' . $this->my_report_data['REPORT_INDEX'],
$this->registry->getClass('reportLibrary')->processUrl( $this->my_report_data['SAVED_URL'], $this->my_report_data['SEOTITLE'], $this->my_report_data['TEMPLATE'] )
if ( $this->memberData['member_id'] )
{
$_subject = sprintf( $this->lang->words['subject_report'],
$this->registry->output->buildSEOUrl( 'showuser=' . $this->memberData['member_id'], 'public', $this->memberData['members_seo_name'], 'showuser' ),
$this->memberData['members_display_name'],
$this->settings['base_url'] . 'app=core&module=reports&do=show_report&rid=' . $this->my_report_data['REPORT_INDEX'],
$this->registry->getClass('reportLibrary')->processUrl( $this->my_report_data['SAVED_URL'], $this->my_report_data['SEOTITLE'], $this->my_report_data['TEMPLATE'] )
);
}
else
{
$_subject = sprintf( $this->lang->words['subject_report_guest'],
$this->memberData['members_display_name'],
$this->settings['base_url'] . 'app=core&module=reports&do=show_report&rid=' . $this->my_report_data['REPORT_INDEX'],
$this->registry->getClass('reportLibrary')->processUrl( $this->my_report_data['SAVED_URL'], $this->my_report_data['SEOTITLE'], $this->my_report_data['TEMPLATE'] )
);
}
$notifyLibrary->setMember( $user );
$notifyLibrary->setFrom( $this->memberData );
$notifyLibrary->setNotificationKey( 'report_center' );
$notifyLibrary->setNotificationUrl( $this->settings['base_url'] . 'app=core&module=reports&do=show_report&rid=' . $this->my_report_data['REPORT_INDEX'] );
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
$notifyLibrary->setNotificationText( str_replace( '#member_name#', $user['members_display_name'], IPSText::getTextClass('email')->message ) );
$notifyLibrary->setNotificationTitle( $_subject );
try