Version 2.2.0 RC-1
This commit is contained in:
1 parent
f73f8bff6d
commit
22f1b963ee
1034 files changed
+178610
-70897
No files matched your search
@@ -2,24 +2,14 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
|
||||
| > $Revision: 23 $
|
||||
@@ -38,9 +28,45 @@
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
* To follow
|
||||
$api = new api_topic_view();
|
||||
$api->ipsclass =& $this->ipsclass;
|
||||
$api->topic_list_config['forums'] = array( 1,2,3,4 );
|
||||
$api->topic_list_config['limit'] = 10;
|
||||
$topics = $api->return_topic_list_data();
|
||||
// Loop on $topics and output the data
|
||||
* </code>
|
||||
*
|
||||
* API will return attachment data in an array
|
||||
* attachment_data - you are responsible for any
|
||||
* processing or displaying if you wish to do so
|
||||
*
|
||||
* Attachment data returned will be in an array with the
|
||||
* topic/post data like so:
|
||||
|
||||
[attachment_data] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[size] => 41.29
|
||||
[method] => post
|
||||
[id] => 24
|
||||
[file] => somefile.jpg
|
||||
[hits] => 0
|
||||
[thumb_location] =>
|
||||
[type] => image
|
||||
[thumb_x] => 0
|
||||
[thumb_y] => 0
|
||||
[ext] => jpg
|
||||
)
|
||||
|
||||
)
|
||||
* You can then loop on the attachment_data key (if
|
||||
* it exists - it won't exist if there are no attachments)
|
||||
* and process each attachment in the record.
|
||||
*
|
||||
* Attachment types - thumb = thumbnail, image = regular image
|
||||
* reg = regular attachment
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Matt Mecham
|
||||
@@ -92,6 +118,8 @@ class api_topic_view extends api_core
|
||||
'order_field' => 'last_post',
|
||||
'order_by' => 'DESC' );
|
||||
|
||||
var $attach_pids = array();
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Returns an array of topic data
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -110,6 +138,8 @@ class api_topic_view extends api_core
|
||||
|
||||
$topics = array();
|
||||
|
||||
$this->ipsclass->init_load_cache( array( 'bbcode','emoticons','attachtypes' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load parser
|
||||
//-----------------------------------------
|
||||
@@ -166,6 +196,11 @@ class api_topic_view extends api_core
|
||||
|
||||
$row['post'] = $parser->pre_display_parse( $row['post'] );
|
||||
|
||||
if( $row['topic_hasattach'] )
|
||||
{
|
||||
$this->attach_pids[] = $row['pid'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Guest name?
|
||||
//-----------------------------------------
|
||||
@@ -181,24 +216,115 @@ class api_topic_view extends api_core
|
||||
|
||||
$topics[] = $row;
|
||||
}
|
||||
|
||||
|
||||
if( count( $this->attach_pids ) )
|
||||
{
|
||||
$final_attachments = array();
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_pid IN (".implode(",", $this->attach_pids).")"
|
||||
) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $a = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$final_attachments[ $a[ 'attach_pid' ] ][ $a['attach_id'] ] = $a;
|
||||
}
|
||||
|
||||
$final_topics = array();
|
||||
|
||||
foreach( $topics as $mytopic )
|
||||
{
|
||||
$this_topic_attachments = array();
|
||||
|
||||
foreach ( $final_attachments as $pid => $data )
|
||||
{
|
||||
if( $pid <> $mytopic['pid'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$temp_out = "";
|
||||
$temp_hold = array();
|
||||
|
||||
foreach( $final_attachments[$pid] as $aid => $row )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Is it an image, and are we viewing the image in the post?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->vars['show_img_upload'] and $row['attach_is_image'] )
|
||||
{
|
||||
if ( $this->ipsclass->vars['siu_thumb'] AND $row['attach_thumb_location'] AND $row['attach_thumb_width'] )
|
||||
{
|
||||
$this_topic_attachments[] = array( 'size' => $this->ipsclass->size_format( $row['attach_filesize'] ),
|
||||
'method' => 'post',
|
||||
'id' => $row['attach_id'],
|
||||
'file' => $row['attach_file'],
|
||||
'hits' => $row['attach_hits'],
|
||||
'thumb_location' => $row['attach_thumb_location'],
|
||||
'type' => 'thumb',
|
||||
'thumb_x' => $row['attach_thumb_width'],
|
||||
'thumb_y' => $row['attach_thumb_height'],
|
||||
'ext' => $row['attach_ext'],
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this_topic_attachments[] = array( 'size' => $this->ipsclass->size_format( $row['attach_filesize'] ),
|
||||
'method' => 'post',
|
||||
'id' => $row['attach_id'],
|
||||
'file' => $row['attach_file'],
|
||||
'hits' => $row['attach_hits'],
|
||||
'thumb_location' => $row['attach_thumb_location'],
|
||||
'type' => 'image',
|
||||
'thumb_x' => $row['attach_thumb_width'],
|
||||
'thumb_y' => $row['attach_thumb_height'],
|
||||
'ext' => $row['attach_ext'],
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this_topic_attachments[] = array( 'size' => $this->ipsclass->size_format( $row['attach_filesize'] ),
|
||||
'method' => 'post',
|
||||
'id' => $row['attach_id'],
|
||||
'file' => $row['attach_file'],
|
||||
'hits' => $row['attach_hits'],
|
||||
'thumb_location' => $row['attach_thumb_location'],
|
||||
'type' => 'reg',
|
||||
'thumb_x' => $row['attach_thumb_width'],
|
||||
'thumb_y' => $row['attach_thumb_height'],
|
||||
'ext' => $row['attach_ext'],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( count( $this_topic_attachments ) )
|
||||
{
|
||||
$mytopic['attachment_data'] = $this_topic_attachments;
|
||||
}
|
||||
|
||||
$final_topics[] = $mytopic;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Return...
|
||||
//-----------------------------------------
|
||||
|
||||
return $topics;
|
||||
|
||||
if( count( $final_topics ) )
|
||||
{
|
||||
return $final_topics;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $topics;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user