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,27 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| 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 $
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
@@ -124,6 +114,13 @@ class api_components extends api_core
|
||||
*/
|
||||
var $component;
|
||||
|
||||
/**
|
||||
* XML Parser Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
var $xml;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Get component by key
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -164,6 +161,120 @@ class api_components extends api_core
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Import XML File
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Updates/inserts a component from xml file
|
||||
*
|
||||
* @param string Path to XML File
|
||||
* @return array;
|
||||
*/
|
||||
function acp_component_import( $xml_file_path )
|
||||
{
|
||||
if( !file_exists($xml_file_path) )
|
||||
{
|
||||
return array( 'inserted' => 0, 'updated' => 0 );
|
||||
}
|
||||
|
||||
$content = implode( '', @file( $xml_file_path ) );
|
||||
|
||||
if( !$content )
|
||||
{
|
||||
return array( 'inserted' => 0, 'updated' => 0 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get current components.
|
||||
//-----------------------------------------
|
||||
$cur_components = array();
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'com_id, com_section',
|
||||
'from' => 'components',
|
||||
'order' => 'com_id' ) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$cur_components[ $r['com_section'] ] = $r['com_id'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get xml mah-do-dah
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( KERNEL_PATH.'class_xml.php' );
|
||||
|
||||
$this->xml = new class_xml();
|
||||
|
||||
//-----------------------------------------
|
||||
// Unpack the datafile
|
||||
//-----------------------------------------
|
||||
|
||||
$this->xml->xml_parse_document( $content );
|
||||
|
||||
//-----------------------------------------
|
||||
// pArse
|
||||
//-----------------------------------------
|
||||
|
||||
$fields = array( 'com_title' , 'com_description', 'com_author' , 'com_url', 'com_version', 'com_menu_data',
|
||||
'com_enabled' , 'com_safemode' , 'com_section', 'com_filename' );
|
||||
|
||||
if ( ! is_array( $this->xml->xml_array['componentexport']['componentgroup']['component'][0] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Ensure [0] is populated
|
||||
//-----------------------------------------
|
||||
|
||||
$tmp = $this->xml->xml_array['componentexport']['componentgroup']['component'];
|
||||
|
||||
unset($this->xml->xml_array['componentexport']['componentgroup']['component']);
|
||||
|
||||
$this->xml->xml_array['componentexport']['componentgroup']['component'][0] = $tmp;
|
||||
}
|
||||
|
||||
$updated = $inserted = 0;
|
||||
|
||||
foreach( $this->xml->xml_array['componentexport']['componentgroup']['component'] as $id => $entry )
|
||||
{
|
||||
$newrow = array();
|
||||
|
||||
foreach( $fields as $f )
|
||||
{
|
||||
$newrow[$f] = $entry[ $f ]['VALUE'];
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'com_version' => 'string' );
|
||||
|
||||
if ( $cur_components[ $entry['com_section']['VALUE'] ] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( 'components', $newrow, 'com_id='.$cur_components[ $entry['com_section']['VALUE'] ] );
|
||||
$updated++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INSERT
|
||||
//-----------------------------------------
|
||||
|
||||
$newrow['com_date_added'] = time();
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'components', $newrow );
|
||||
$inserted++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->acp_component_rebuildcache();
|
||||
|
||||
return array( 'inserted' => $inserted, 'updated' => $updated );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Update component
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
@@ -2,27 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| 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-12-02 10:17:19 +0000 (Fri, 02 Dec 2005) $
|
||||
| > $Revision: 89 $
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
@@ -99,14 +89,14 @@ class api_core
|
||||
*
|
||||
* @var string Path to IPB root folder
|
||||
*/
|
||||
var $path_to_ipb = './';
|
||||
var $path_to_ipb = '../../';
|
||||
|
||||
/**
|
||||
* API Load classes
|
||||
*
|
||||
* @var array Classes to load default: [display,forums,converge,session]
|
||||
* @var array Classes to load default: [print,forums,converge,session]
|
||||
*/
|
||||
var $load_classes = array( 'display' => 1,
|
||||
var $load_classes = array( 'print' => 1,
|
||||
'forums' => 1,
|
||||
'converge' => 1,
|
||||
'session' => 1 );
|
||||
@@ -228,7 +218,7 @@ class api_core
|
||||
|
||||
if ( ! defined('IPSCLASS_CACHE_LOADED') )
|
||||
{
|
||||
$this->ipsclass->init_load_cache( array('rss_export', 'bbcode', 'badwords', 'emoticons', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats') );
|
||||
$this->ipsclass->init_load_cache( array('rss_export', 'bbcode', 'attachtypes', 'badwords', 'emoticons', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'languages', 'forum_cache', 'moderators', 'stats') );
|
||||
}
|
||||
|
||||
if ( ! defined('IPSCLASS_INITIATED') )
|
||||
|
||||
@@ -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 $
|
||||
|
||||
@@ -2,27 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| 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-11-30 12:25:19 +0000 (Wed, 30 Nov 2005) $
|
||||
| > $Revision: 86 $
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
@@ -159,15 +149,17 @@ class api_language extends api_core
|
||||
// Write output
|
||||
//-------------------------------
|
||||
|
||||
$start = "<?php\n\n";
|
||||
$start = "<?php\n\n".'$lang = array('."\n";
|
||||
|
||||
foreach( $lang as $key => $text)
|
||||
{
|
||||
$text = preg_replace("/\n{1,}$/", "", $text);
|
||||
$start .= "\n".'$lang['."'$key'".'] = "'.addslashes($text).'";';
|
||||
$text = stripslashes($text);
|
||||
$text = preg_replace( '/"/', '\\"', $text );
|
||||
$start .= "\n'".$key."' => \"".$text."\",";
|
||||
}
|
||||
|
||||
$start .= "\n\n?".">";
|
||||
$start .= "\n\n);\n\n?".">";
|
||||
|
||||
if ( $fh = fopen( $lang_file, 'w') )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,405 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-05-25 10:15:22 -0400 (Thu, 25 May 2006) $
|
||||
| > $Revision: 278 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Settings
|
||||
| > Module written by Brandon Farber
|
||||
| > Date started: Tuesday June 6th 2006 (11:12)
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Settings
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
* $api = new api_settings();
|
||||
* # Optional - if $ipsclass is not passed, it'll init
|
||||
* $api->ipsclass =& $this->ipsclass;
|
||||
* $api->api_init();
|
||||
* $api->update_settings( $path_to_xml_file );
|
||||
* </code>
|
||||
*
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Matt Mecham
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IPS_API_PATH' ) )
|
||||
{
|
||||
/**
|
||||
* Define classes path
|
||||
*/
|
||||
define( 'IPS_API_PATH', dirname(__FILE__) ? dirname(__FILE__) : '.' );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'api_core' ) )
|
||||
{
|
||||
require_once( IPS_API_PATH.'/api_core.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Settings
|
||||
*
|
||||
* This class deals with settings insertion functions
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @version 2.2
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class api_settings extends api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
//var $ipsclass;
|
||||
|
||||
var $xml;
|
||||
|
||||
var $setting_groups = array();
|
||||
var $setting_groups_by_key = array();
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Add settings to IPB (existing settings are updated)
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Adds or updates settings in IPB
|
||||
*
|
||||
* @param string Path to xml file containing settings
|
||||
* @param array Defaults for settings in XML file (key => value)
|
||||
* @param array Current values for settings in XML file (key => value)
|
||||
* @return void;
|
||||
*/
|
||||
function update_settings( $xml_file_path, $defaults=array(), $vals=array() )
|
||||
{
|
||||
//-------------------------------
|
||||
// Check?
|
||||
//-------------------------------
|
||||
|
||||
if ( !$xml_file_path )
|
||||
{
|
||||
$this->api_error[] = "input_missing_fields";
|
||||
return;
|
||||
}
|
||||
|
||||
require_once( KERNEL_PATH.'class_xml.php' );
|
||||
|
||||
$this->xml = new class_xml();
|
||||
|
||||
//-------------------------------
|
||||
// Get file contents
|
||||
//-------------------------------
|
||||
|
||||
$settings_content = implode( "", file($xml_file_path) );
|
||||
|
||||
if( !$settings_content )
|
||||
{
|
||||
$this->api_error[] = "invalid_file";
|
||||
return;
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
// Unpack the datafile (SETTINGS)
|
||||
//-------------------------------
|
||||
|
||||
$this->xml->xml_parse_document( $settings_content );
|
||||
|
||||
//-------------------------------
|
||||
// Get current settings.
|
||||
//-------------------------------
|
||||
|
||||
$cur_settings = array();
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'conf_id, conf_key',
|
||||
'from' => 'conf_settings',
|
||||
'order' => 'conf_id' ) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$cur_settings[ $r['conf_key'] ] = $r['conf_id'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get current titles
|
||||
//-----------------------------------------
|
||||
|
||||
$this->setting_get_groups();
|
||||
|
||||
//-----------------------------------------
|
||||
// pArse
|
||||
//-----------------------------------------
|
||||
|
||||
$fields = array( 'conf_title' , 'conf_description', 'conf_group' , 'conf_type' , 'conf_key' , 'conf_default',
|
||||
'conf_extra' , 'conf_evalphp' , 'conf_protected', 'conf_position', 'conf_start_group', 'conf_end_group',
|
||||
'conf_help_key', 'conf_add_cache' , 'conf_title_keyword' );
|
||||
|
||||
$setting_fields = array( 'conf_title_keyword', 'conf_title_title', 'conf_title_desc', 'conf_title_noshow' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! is_array( $this->xml->xml_array['settingexport']['settinggroup']['setting'][0] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Ensure [0] is populated
|
||||
//-----------------------------------------
|
||||
|
||||
$tmp = $this->xml->xml_array['settingexport']['settinggroup']['setting'];
|
||||
|
||||
unset($this->xml->xml_array['settingexport']['settinggroup']['setting']);
|
||||
|
||||
$this->xml->xml_array['settingexport']['settinggroup']['setting'][0] = $tmp;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop through and sort out settings...
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $this->xml->xml_array['settingexport']['settinggroup']['setting'] as $id => $entry )
|
||||
{
|
||||
$newrow = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Is setting?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $entry['conf_is_title']['VALUE'] )
|
||||
{
|
||||
foreach( $fields as $f )
|
||||
{
|
||||
$newrow[$f] = $entry[ $f ]['VALUE'];
|
||||
}
|
||||
|
||||
$new_settings[] = $newrow;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Is title?
|
||||
//-----------------------------------------
|
||||
|
||||
else
|
||||
{
|
||||
foreach( $setting_fields as $f )
|
||||
{
|
||||
$newrow[$f] = $entry[ $f ]['VALUE'];
|
||||
}
|
||||
|
||||
$new_titles[] = $newrow;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out titles...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $new_titles ) and count( $new_titles ) )
|
||||
{
|
||||
foreach( $new_titles as $idx => $data )
|
||||
{
|
||||
if ( $data['conf_title_title'] AND $data['conf_title_keyword'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get ID based on key
|
||||
//-----------------------------------------
|
||||
|
||||
$conf_id = $this->setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
|
||||
|
||||
$save = array( 'conf_title_title' => $data['conf_title_title'],
|
||||
'conf_title_desc' => $data['conf_title_desc'],
|
||||
'conf_title_keyword' => $data['conf_title_keyword'],
|
||||
'conf_title_noshow' => $data['conf_title_noshow'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Not got a row, insert first!
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $conf_id )
|
||||
{
|
||||
$this->ipsclass->DB->do_insert( 'conf_settings_titles', $save );
|
||||
$conf_id = $this->ipsclass->DB->get_insert_id();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( 'conf_settings_titles', $save, 'conf_title_id='.$conf_id );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update settings cache
|
||||
//-----------------------------------------
|
||||
|
||||
$save['conf_title_id'] = $conf_id;
|
||||
$this->setting_groups_by_key[ $save['conf_title_keyword'] ] = $save;
|
||||
$this->setting_groups[ $save['conf_title_id'] ] = $save;
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove need update...
|
||||
//-----------------------------------------
|
||||
|
||||
$need_update[] = $conf_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out settings
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $new_settings ) and count( $new_settings ) )
|
||||
{
|
||||
foreach( $new_settings as $idx => $data )
|
||||
{
|
||||
if( is_array( $vals ) AND count( $vals ) )
|
||||
{
|
||||
foreach( $vals as $k => $v )
|
||||
{
|
||||
if( $data['conf_key'] == $k )
|
||||
{
|
||||
$data['conf_value'] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( is_array( $defaults ) AND count( $defaults ) )
|
||||
{
|
||||
foreach( $defaults as $k => $v )
|
||||
{
|
||||
if( $data['conf_key'] == $k )
|
||||
{
|
||||
$data['conf_default'] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Make PHP slashes safe
|
||||
//-----------------------------------------
|
||||
|
||||
$data['conf_evalphp'] = str_replace( '\\', '\\\\', $data['conf_evalphp'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Now assign to the correct ID based on
|
||||
// our title keyword...
|
||||
//-----------------------------------------
|
||||
|
||||
$data['conf_group'] = $this->setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove from array
|
||||
//-----------------------------------------
|
||||
|
||||
unset( $data['conf_title_keyword'] );
|
||||
|
||||
if ( $cur_settings[ $data['conf_key'] ] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( 'conf_settings', $data, 'conf_id='.$cur_settings[ $data['conf_key'] ] );
|
||||
$updated++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INSERT
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'conf_settings', $data );
|
||||
$inserted++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update group counts...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $need_update ) )
|
||||
{
|
||||
foreach( $need_update as $id )
|
||||
{
|
||||
$conf = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) as count', 'from' => 'conf_settings', 'where' => 'conf_group='.$id ) );
|
||||
|
||||
$count = intval($conf['count']);
|
||||
|
||||
$this->ipsclass->DB->do_update( 'conf_settings_titles', array( 'conf_title_count' => $count ), 'conf_title_id='.$id );
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------
|
||||
// Update the settings cache
|
||||
//----------------------------
|
||||
|
||||
$this->ipsclass->cache['settings'] = array();
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'conf_settings', 'where' => 'conf_add_cache=1' ) );
|
||||
$info = $this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $r = $this->ipsclass->DB->fetch_row($info) )
|
||||
{
|
||||
$value = $r['conf_value'] != "" ? $r['conf_value'] : $r['conf_default'];
|
||||
|
||||
if ( $value == '{blank}' )
|
||||
{
|
||||
$value = '';
|
||||
}
|
||||
|
||||
$this->ipsclass->cache['settings'][ $r['conf_key'] ] = $this->ipsclass->txt_safeslashes($value);
|
||||
}
|
||||
|
||||
$this->ipsclass->update_cache( array( 'name' => 'settings', 'array' => 1, 'deletefirst' => 1 ) );
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// _Internal
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function setting_get_groups()
|
||||
{
|
||||
$this->setting_groups = array();
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'conf_settings_titles', 'order' => 'conf_title_title' ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$this->setting_groups[ $r['conf_title_id'] ] = $r;
|
||||
$this->setting_groups_by_key[ $r['conf_title_keyword'] ] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,555 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-05-25 10:15:22 -0400 (Thu, 25 May 2006) $
|
||||
| > $Revision: 278 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Skins
|
||||
| > Module written by Brandon Farber
|
||||
| > Date started: Tuesday June 6th 2006 (11:12)
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Skins
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
* $api = new api_skins();
|
||||
* # Optional - if $ipsclass is not passed, it'll init
|
||||
* $api->ipsclass =& $this->ipsclass;
|
||||
* $api->api_init();
|
||||
* $api->skin_add_bits( $path_to_xml_file );
|
||||
* $api->skin_add_macros( $path_to_xml_file );
|
||||
* $messages = $api->skin_rebuild_caches( 0 );
|
||||
* print implode( "<br />", $messages[1] );
|
||||
* $messages = $api->skin_rebuild_caches( $messages[0] );
|
||||
* </code>
|
||||
*
|
||||
* Macros for use with this file can be exported via the ACP
|
||||
* Skin Import/Export page
|
||||
*
|
||||
* Templates for use with this file can be exported via the ACP
|
||||
* Skin Sets Overview page when IN_DEV mode is enabled - it is
|
||||
* recommended to add the name of your skin file under the
|
||||
* "Developers: Export Module Skin Files" section to export
|
||||
* all templates for your skin group.
|
||||
*
|
||||
* Example - if you make a skin_links skin template file, enter
|
||||
* "links" in the form field and download the xml file.
|
||||
*
|
||||
* The skin_rebuild_caches rebuilds one skin set at a time - it
|
||||
* rebuilds the next skin set id higher than the id you pass it.
|
||||
* On first function call, pass a 0. On subsequent function
|
||||
* calls pass it the 1st array value (index 0) returned from
|
||||
* the previous call. It rebuilds one skin set at a time to
|
||||
* prevent time outs - it is recommended in your script that
|
||||
* you redirect to a new page passing the appropriate skin id
|
||||
* value after each rebuild - when this function returns a 0
|
||||
* for index 0, all skin sets will be rebuild. Index 1 of the
|
||||
array returned will be an array of messages.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Matt Mecham
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IPS_API_PATH' ) )
|
||||
{
|
||||
/**
|
||||
* Define classes path
|
||||
*/
|
||||
define( 'IPS_API_PATH', dirname(__FILE__) ? dirname(__FILE__) : '.' );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'api_core' ) )
|
||||
{
|
||||
require_once( IPS_API_PATH.'/api_core.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Skins
|
||||
*
|
||||
* This class deals with all available skin insertion functions.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @version 2.2
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class api_skins extends api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
//var $ipsclass;
|
||||
|
||||
var $xml;
|
||||
var $cache_func;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Add skin templates to IPB
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Adds skin templates to IPB master template set which will filter down to child skins
|
||||
*
|
||||
* @param string Path to xml file containing skin templates (Note: templates can
|
||||
* be exported from ACP when IN_DEV mode is enabled with the
|
||||
* Developer Export options at the bottom of the skin sets overview)
|
||||
* @return void;
|
||||
*/
|
||||
function skin_add_bits( $xml_file_path )
|
||||
{
|
||||
//-------------------------------
|
||||
// Check?
|
||||
//-------------------------------
|
||||
|
||||
if ( ! $xml_file_path )
|
||||
{
|
||||
$this->api_error[] = "input_missing_fields";
|
||||
return;
|
||||
}
|
||||
|
||||
require_once( KERNEL_PATH.'class_xml.php' );
|
||||
|
||||
$this->xml = new class_xml();
|
||||
|
||||
//-------------------------------
|
||||
// Get file contents
|
||||
//-------------------------------
|
||||
|
||||
$skin_content = implode( "", file($xml_file_path) );
|
||||
|
||||
//-------------------------------
|
||||
// Unpack the datafile (TEMPLATES)
|
||||
//-------------------------------
|
||||
|
||||
$this->xml->xml_parse_document( $skin_content );
|
||||
|
||||
//-------------------------------
|
||||
// (TEMPLATES)
|
||||
//-------------------------------
|
||||
|
||||
if ( ! is_array( $this->xml->xml_array['templateexport']['templategroup']['template'] ) )
|
||||
{
|
||||
$this->api_error[] = "xml_file_not_valid";
|
||||
return;
|
||||
}
|
||||
|
||||
foreach( $this->xml->xml_array['templateexport']['templategroup']['template'] as $id => $entry )
|
||||
{
|
||||
$this->ipsclass->DB->allow_sub_select = 1;
|
||||
|
||||
$row = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'suid',
|
||||
'from' => 'skin_templates',
|
||||
'where' => "group_name='{$entry['group_name']['VALUE']}' AND func_name='{$entry['func_name']['VALUE']}' and set_id=1"
|
||||
) );
|
||||
|
||||
if ( $row['suid'] )
|
||||
{
|
||||
$this->ipsclass->DB->allow_sub_select = 1;
|
||||
|
||||
$this->ipsclass->DB->do_update( 'skin_templates', array( 'func_data' => $entry[ 'func_data' ]['VALUE'],
|
||||
'section_content' => $entry[ 'section_content' ]['VALUE'],
|
||||
'updated' => time()
|
||||
)
|
||||
, 'suid='.$row['suid'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->DB->allow_sub_select = 1;
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'skin_templates', array( 'func_data' => $entry[ 'func_data' ]['VALUE'],
|
||||
'func_name' => $entry[ 'func_name' ]['VALUE'],
|
||||
'section_content' => $entry[ 'section_content' ]['VALUE'],
|
||||
'group_name' => $entry[ 'group_name' ]['VALUE'],
|
||||
'updated' => time(),
|
||||
'set_id' => 1
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Add macros to IPB
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Adds macros to IPB master templates which will filter down to child skins
|
||||
*
|
||||
* @param string Path to xml file containing macros (Note: macros can
|
||||
* be exported from ACP when IN_DEV mode is enabled)
|
||||
* @return void;
|
||||
*/
|
||||
function skin_add_macros( $xml_file_path )
|
||||
{
|
||||
//-------------------------------
|
||||
// Check?
|
||||
//-------------------------------
|
||||
|
||||
if ( !$xml_file_path )
|
||||
{
|
||||
$this->api_error[] = "input_missing_fields";
|
||||
return;
|
||||
}
|
||||
|
||||
require_once( KERNEL_PATH.'class_xml.php' );
|
||||
|
||||
$this->xml = new class_xml();
|
||||
|
||||
//-------------------------------
|
||||
// Get file contents
|
||||
//-------------------------------
|
||||
|
||||
$macro_content = implode( "", file($xml_file_path) );
|
||||
|
||||
//-------------------------------
|
||||
// Unpack the datafile (TEMPLATES)
|
||||
//-------------------------------
|
||||
|
||||
$this->xml->xml_parse_document( $macro_content );
|
||||
|
||||
//-------------------------------
|
||||
// (MACRO)
|
||||
//-------------------------------
|
||||
|
||||
if ( ! is_array( $this->xml->xml_array['macroexport']['macrogroup']['macro'] ) )
|
||||
{
|
||||
$this->api_error[] = "xml_file_not_valid";
|
||||
return;
|
||||
}
|
||||
|
||||
foreach( $this->xml->xml_array['macroexport']['macrogroup']['macro'] as $id => $entry )
|
||||
{
|
||||
$this->ipsclass->DB->allow_sub_select = 1;
|
||||
|
||||
$row = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'macro_id',
|
||||
'from' => 'skin_macro',
|
||||
'where' => "macro_value='{$entry['macro_value']['VALUE']}' and macro_set=1"
|
||||
) );
|
||||
if ( $row['macro_id'] )
|
||||
{
|
||||
$this->ipsclass->DB->allow_sub_select = 1;
|
||||
|
||||
$this->ipsclass->DB->do_update( 'skin_macro', array( 'macro_replace' => $entry['macro_replace']['VALUE'] ), "macro_value='{$entry['macro_value']['VALUE']}' and macro_set=1" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->DB->allow_sub_select = 1;
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'skin_macro', array( 'macro_value' => $entry['macro_value']['VALUE'],
|
||||
'macro_replace' => $entry['macro_replace']['VALUE'],
|
||||
'macro_set' => 1 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Rebuild skin caches
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Rebuilds template caches to cache new skins to .php files
|
||||
*
|
||||
* @param int Last skin id completed (returned upon completion of prior skin)
|
||||
* @return array Returns: Skin id completed (which can be passed back to this
|
||||
* function on next run) and an array of messages
|
||||
*/
|
||||
function skin_rebuild_caches( $completed=1 )
|
||||
{
|
||||
$this->ipsclass->DB->load_cache_file( ROOT_PATH.'sources/sql/'.SQL_DRIVER.'_api_queries.php', 'sql_api_queries' );
|
||||
|
||||
//-----------------------------------
|
||||
// Get ACP library
|
||||
//-----------------------------------
|
||||
|
||||
require_once( ROOT_PATH.'sources/lib/admin_cache_functions.php' );
|
||||
$this->cache_func = new admin_cache_functions();
|
||||
$this->cache_func->ipsclass =& $this->ipsclass;
|
||||
|
||||
//-----------------------------------
|
||||
// Image cache url
|
||||
//-----------------------------------
|
||||
|
||||
$row = $this->ipsclass->DB->simple_exec_query ( array ( 'select' => 'conf_value, conf_default', 'from' => 'conf_settings', 'where' => "conf_key='ipb_img_url'" ) );
|
||||
|
||||
$this->ipsclass->vars['ipb_img_url'] = $row['conf_value'] != "" ? $row['conf_value'] : $row['conf_default'];
|
||||
|
||||
if ( $this->ipsclass->vars['ipb_img_url'] == "{blank}" )
|
||||
{
|
||||
$this->ipsclass->vars['ipb_img_url'] = "";
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
// Next skin to do?
|
||||
//-------------------------------
|
||||
|
||||
$completed = $completed > 0 ? intval($completed) : 1;
|
||||
|
||||
//-----------------------------------
|
||||
// Get skins
|
||||
//-----------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
|
||||
'from' => 'skin_sets',
|
||||
'where' => 'set_skin_set_id > '.$completed,
|
||||
'order' => 'set_skin_set_id',
|
||||
'limit' => array( 0, 1 )
|
||||
) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
//-----------------------------------
|
||||
// Got a biggun?
|
||||
//-----------------------------------
|
||||
|
||||
$r = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
if ( $r['set_skin_set_id'] )
|
||||
{
|
||||
$this->cache_func->_rebuild_all_caches( array($r['set_skin_set_id']) );
|
||||
|
||||
return array( 'completed' => $r['set_skin_set_id'], 'messages' => $this->cache_func->messages );
|
||||
}
|
||||
else
|
||||
{
|
||||
return array( 'completed' => 0, 'messages' => array( 'No more skins to rebuild' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Rebuild update template bit
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Updates a template bit from a previous version to the current version
|
||||
* NOTE: This only changes the format of the data and doesn't update the
|
||||
* actual HTML.
|
||||
*
|
||||
* @param string Template HTML
|
||||
* @return string Template HTML
|
||||
*/
|
||||
function skin_update_template_bit( $html='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$debug = 0;
|
||||
$_html = $html;
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up basic tags
|
||||
//-----------------------------------------
|
||||
|
||||
$html = preg_replace( "/{ipb\.script_url}/i", '{$this->ipsclass->base_url}' , $html);
|
||||
$html = preg_replace( "/{ipb\.session_id}/i", '{$this->ipsclass->session_id}', $html);
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up the IF statements
|
||||
//-----------------------------------------
|
||||
|
||||
# IF / ELSE IF / ELSE
|
||||
$html = preg_replace_callback( "#(?:\s+?)?<(if=[\"'].+?[\"'])>(.+?)</if>\s+?<else (if=[\"'].+?[\"'])>(.+?)</if>\s+?<else>(.+?)</else>#is", array( $this, '_func_fix_if_elseif_else' ), $html );
|
||||
# IF / ELSE IF
|
||||
$html = preg_replace_callback( "#(?:\s+?)?<(if=[\"'].+?[\"'])>(.+?)</if>\s+?<else (if=[\"'].+?[\"'])>(.+?)</if>#is", array( $this, '_func_fix_if_elseif_else' ), $html );
|
||||
# IF / ELSE
|
||||
$html = preg_replace_callback( "#(?:\s+?)?<(if=[\"'].+?[\"'])>(.+?)</if>\s+?<else>(.+?)</else>#is", array( $this, '_func_fix_if_elseif_else' ), $html );
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out the IF content
|
||||
//-----------------------------------------
|
||||
|
||||
$html = preg_replace_callback( "#<if=([\"'])(.+?)[\"']>#is", array( $this, '_func_check_if_statement' ), $html );
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out the rest of the tags...
|
||||
//-----------------------------------------
|
||||
|
||||
$html = preg_replace( "#ipb\.(member|vars|skin|lang|input)#i", '$this->ipsclass->\\1', $html );
|
||||
|
||||
#print "<pre>". htmlspecialchars( $html ); exit();
|
||||
|
||||
if ( $debug )
|
||||
{
|
||||
$_string = "\n===================================================";
|
||||
$_string .= "\n Date: ". date( 'r' );
|
||||
$_string .= "\n---ORIGINAL----------------------------------------";
|
||||
$_string .= "\n".$_html;
|
||||
$_string .= "\n---CONVERTED---------------------------------------";
|
||||
$_string .= "\n".$html;
|
||||
|
||||
if ( $FH = @fopen( ROOT_PATH . 'cache/template_update_debug_log_'.date('m_d_y').'.cgi', 'a' ) )
|
||||
{
|
||||
@fwrite( $FH, $_string );
|
||||
@fclose( $FH );
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Fix up an if / else if / else statement
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* <if="">
|
||||
* MAIN IF
|
||||
* <else />
|
||||
* <if="">
|
||||
* ELSE IF
|
||||
* <else />
|
||||
* ELSE
|
||||
* </if>
|
||||
* </if>
|
||||
*/
|
||||
function _func_fix_if_elseif_else( $matches=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$if = '';
|
||||
$if_html = '';
|
||||
$else_if = '';
|
||||
$else_if_html = '';
|
||||
$else_html = '';
|
||||
$formatted = '';
|
||||
|
||||
//-----------------------------------------
|
||||
// What are we doing?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $matches ) == 6 )
|
||||
{
|
||||
$if = trim( $matches[1] );
|
||||
$if_html = trim( $matches[2] );
|
||||
$else_if = trim( $matches[3] );
|
||||
$else_if_html = trim( $matches[4] );
|
||||
$else_html = trim( $matches[5] );
|
||||
}
|
||||
else if ( count( $matches ) == 5 )
|
||||
{
|
||||
$if = trim( $matches[1] );
|
||||
$if_html = trim( $matches[2] );
|
||||
$else_if = trim( $matches[3] );
|
||||
$else_if_html = trim( $matches[4] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$if = trim( $matches[1] );
|
||||
$if_html = trim( $matches[2] );
|
||||
$else_html = trim( $matches[3] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// OK...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $if AND $else_if AND $else_html )
|
||||
{
|
||||
$formatted = "<".$if.">\n";
|
||||
$formatted .= $if_html . "\n";
|
||||
$formatted .= "<else />\n";
|
||||
$formatted .= "\t<".$else_if.">\n";
|
||||
$formatted .= $else_if_html."\n";
|
||||
$formatted .= "\t<else />\n";
|
||||
$formatted .= $else_html . "\n";
|
||||
$formatted .= "\t</if>\n";
|
||||
$formatted .= "</if>\n";
|
||||
}
|
||||
else if ( $if AND $else_if )
|
||||
{
|
||||
$formatted = "<".$if.">\n";
|
||||
$formatted .= $if_html . "\n";
|
||||
$formatted .= "<else />\n";
|
||||
$formatted .= "\t<".$else_if.">\n";
|
||||
$formatted .= $else_if_html."\n";
|
||||
$formatted .= "\t</if>\n";
|
||||
$formatted .= "</if>\n";
|
||||
}
|
||||
else if ( $if AND $else_html )
|
||||
{
|
||||
$formatted = "<".$if.">\n";
|
||||
$formatted .= $if_html . "\n";
|
||||
$formatted .= "<else />\n";
|
||||
$formatted .= $else_html."\n";
|
||||
$formatted .= "</if>\n";
|
||||
}
|
||||
|
||||
return $formatted;
|
||||
}
|
||||
|
||||
//===================================================
|
||||
// Sort out left bit of comparison
|
||||
//===================================================
|
||||
|
||||
function _func_fix_if_statement($left, $andor="", $fs="", $ls="")
|
||||
{
|
||||
$left = trim($this->_trim_slashes($left));
|
||||
|
||||
if ( preg_match( "/^ipb\./", $left ) )
|
||||
{
|
||||
$left = preg_replace( "/^ipb\.(.+?)$/", '$this->ipsclass->'."\\1", $left );
|
||||
}
|
||||
else
|
||||
{
|
||||
$left = '$'.$left;
|
||||
}
|
||||
|
||||
return $andor.$fs.$left.$ls;
|
||||
}
|
||||
|
||||
//===================================================
|
||||
// Statement: Prep AND OR, etc
|
||||
//===================================================
|
||||
|
||||
function _func_check_if_statement( $matches=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$quotes = $matches[1];
|
||||
$code = $this->_trim_slashes( $matches[2] );
|
||||
|
||||
$code = preg_replace( "/(^|and|or)(\s+)(.+?)(\s|$)/ise", "\$this->_func_fix_if_statement('\\3', '\\1', '\\2', '\\4')", ' '.$code );
|
||||
|
||||
$code = preg_replace( '#\${1,}#i', '$', $code );
|
||||
|
||||
return "<if=".$quotes.trim($code).$quotes.">";
|
||||
}
|
||||
|
||||
//===================================================
|
||||
// Remove leading and trailing newlines
|
||||
//===================================================
|
||||
|
||||
function _trim_slashes($code)
|
||||
{
|
||||
$code = str_replace( '\"' , '"', $code );
|
||||
$code = str_replace( "\\'", "'", $code );
|
||||
return $code;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -2,28 +2,18 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| 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: 2006-02-01 18:16:26 +0000 (Wed, 01 Feb 2006) $
|
||||
| > $Revision: 132 $
|
||||
| > $Author: bfarber $
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Topics and Posts
|
||||
@@ -201,6 +191,7 @@ class api_topics_and_posts extends api_core
|
||||
'is_invisible' => 0,
|
||||
'post_date' => 0,
|
||||
'ip_address' => 0,
|
||||
'post_htmlstate' => 0,
|
||||
'parse_html' => 0 );
|
||||
|
||||
/**
|
||||
@@ -367,7 +358,7 @@ class api_topics_and_posts extends api_core
|
||||
'author_name' => $this->author['members_display_name'],
|
||||
'topic_id' => $this->topic_id,
|
||||
'queued' => $this->post_settings['is_invisible'],
|
||||
'post_htmlstate' => 0,
|
||||
'post_htmlstate' => $this->post_settings['post_htmlstate'],
|
||||
'post_key' => md5( time() ),
|
||||
);
|
||||
|
||||
@@ -545,7 +536,7 @@ class api_topics_and_posts extends api_core
|
||||
{
|
||||
$this->author = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'members',
|
||||
'where' => "LOWER(name) = '".$this->ipsclass->DB->add_slashes(strtolower($user_name))."'",
|
||||
'where' => "members_l_username = '".$this->ipsclass->DB->add_slashes(strtolower($user_name))."'",
|
||||
'limit' => array( 0, 1 ) ) );
|
||||
|
||||
if ( ! $this->author['id'] )
|
||||
@@ -597,7 +588,7 @@ class api_topics_and_posts extends api_core
|
||||
{
|
||||
$this->author = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'members',
|
||||
'where' => "LOWER(members_display_name) = '".$this->ipsclass->DB->add_slashes(strtolower($display_name))."'",
|
||||
'where' => "members_l_display_name = '".$this->ipsclass->DB->add_slashes(strtolower($display_name))."'",
|
||||
'limit' => array( 0, 1 ) ) );
|
||||
|
||||
if ( ! $this->author['id'] )
|
||||
@@ -755,6 +746,7 @@ class api_topics_and_posts extends api_core
|
||||
require_once( ROOT_PATH."sources/classes/editor/class_editor_rte.php" );
|
||||
$this->editor = new class_editor_module();
|
||||
$this->editor->ipsclass =& $this->ipsclass;
|
||||
$this->editor->allow_html = $this->post_settings['parse_html'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-06-26 22:03:22 -0400 (Wed, 26 July 2006) $
|
||||
| > $Revision: 1 $
|
||||
| > $Author: w1lz0r $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Blog
|
||||
| > Module written by Remco Wilting
|
||||
| > Date started: Wednesday July 26th 2006 (21:22)
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Blog
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
* $api = new api_blog();
|
||||
* # Optional - if $ipsclass is not passed, it'll init
|
||||
* $api->ipsclass =& $this->ipsclass;
|
||||
* $api->api_init();
|
||||
* $api->get_blog_id( $member_id );
|
||||
* $api->last_x_entries( $blog_id, $number_of_entries );
|
||||
* </code>
|
||||
*
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Matt Mecham
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IPS_API_PATH' ) )
|
||||
{
|
||||
/**
|
||||
* Define classes path
|
||||
*/
|
||||
define( 'IPS_API_PATH', dirname(__FILE__) ? dirname(__FILE__) : '.' );
|
||||
}
|
||||
|
||||
if ( ! defined( 'BLOG_PATH' ) )
|
||||
{
|
||||
define( 'BLOG_PATH', ROOT_PATH.'modules/blog/' );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'api_core' ) )
|
||||
{
|
||||
require_once( IPS_API_PATH.'/api_core.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Blog
|
||||
*
|
||||
* This class deals with settings insertion functions
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @version 2.2
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class api_blog extends api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
var $blog_std;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Retrieve the Blog ID of a member
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Retrieve the Blog ID of a member
|
||||
*
|
||||
* @param int Member ID
|
||||
* @return int Blog ID ( 0 if no Blog found )
|
||||
*/
|
||||
function get_blog_id( $member_id=0 )
|
||||
{
|
||||
$member_id = intval( $member_id );
|
||||
|
||||
//-----------------------------------------
|
||||
// We entered here on member id, find blog_id and redirect them to here
|
||||
//-----------------------------------------
|
||||
$blog = $this->ipsclass->DB->build_and_exec_query( array ( 'select' => 'blog_id, blog_name, blog_friendly_url',
|
||||
'from' => 'blog_blogs',
|
||||
'where' => "member_id={$member_id}" ) );
|
||||
if ( !$blog['blog_id'] or !$blog['blog_name'] )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $blog['blog_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Retrieve the last x entries of a Blog
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Retrieve the last x entries of a Blog
|
||||
* Only public publishes entries are returned
|
||||
*
|
||||
* @param int Blog ID
|
||||
* @param int Number of entries (to return)
|
||||
* @return array Array of last X entries
|
||||
*/
|
||||
|
||||
function last_x_entries( $blog_id, $number_of_entries=10 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load the Blog functions library
|
||||
//-----------------------------------------
|
||||
require_once ( BLOG_PATH.'lib/lib_blogfunctions.php' );
|
||||
$this->blog_std = new blog_functions;
|
||||
$this->blog_std->ipsclass = & $this->ipsclass;
|
||||
|
||||
//-----------------------------------------
|
||||
// Build the permissions
|
||||
//-----------------------------------------
|
||||
$this->blog_std->build_perms();
|
||||
|
||||
if ( $this->ipsclass->check_perms($this->ipsclass->vars['blog_view_perms']) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Private Club Authed?
|
||||
//-----------------------------------------
|
||||
$extra = "";
|
||||
$allowguests = "";
|
||||
if ( !$this->ipsclass->member['id'] )
|
||||
{
|
||||
$allowguests .= " AND b.blog_allowguests = 1";
|
||||
}
|
||||
if ( !$this->ipsclass->member['_blogmod']['moderate_can_view_private'] )
|
||||
{
|
||||
$levelwhere = array( '(bc.blog_id IS NULL)' );
|
||||
if ( $this->ipsclass->member['_cache']['my_blog'] )
|
||||
{
|
||||
$levelwhere[] = "(b.blog_id = {$this->ipsclass->member['_cache']['my_blog']})";
|
||||
}
|
||||
if ( $this->ipsclass->member['_cache']['my_blog'] )
|
||||
{
|
||||
$levelwhere[] = "(bc.category_type = 'private' AND bc.blog_id={$this->ipsclass->member['_cache']['my_blog']})";
|
||||
}
|
||||
if ( is_array($this->ipsclass->member['g_blog_authed_blogs']) && count($this->ipsclass->member['g_blog_authed_blogs'])>1 )
|
||||
{
|
||||
$authblogs = implode(",", $this->ipsclass->member['g_blog_authed_blogs']);
|
||||
$levelwhere[] = "(bc.category_type = 'privateclub' AND bc.blog_id in(".$authblogs."))";
|
||||
$levelwhere[] = "(bc.category_type = 'public')";
|
||||
}
|
||||
else
|
||||
{
|
||||
$authblogs = "";
|
||||
$levelwhere[] = "(bc.category_type = 'public')";
|
||||
}
|
||||
$extra = "b.blog_private=0";
|
||||
if ($authblogs)
|
||||
{
|
||||
$extra = "(".$extra." or b.blog_id in(".$authblogs.($this->ipsclass->member['_cache']['my_blog']?",".$this->ipsclass->member['_cache']['my_blog']:"")."))";
|
||||
}
|
||||
elseif ( $this->ipsclass->member['_cache']['my_blog'] )
|
||||
{
|
||||
$extra = "(".$extra." or b.blog_id = {$this->ipsclass->member['_cache']['my_blog']})";
|
||||
}
|
||||
$extra = " AND ".$extra;
|
||||
$leveljoin = " AND (".implode( " or ", $levelwhere ).")";
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => "e.*",
|
||||
'from' => array('blog_entries' => 'e'),
|
||||
'add_join'=> array( 0 => array( 'select' => 'b.blog_name, b.blog_friendly_url',
|
||||
'from' => array( 'blog_blogs' => 'b' ),
|
||||
'where' => "e.blog_id=b.blog_id",
|
||||
'type' => 'left'
|
||||
),
|
||||
1 => array( 'from' => array( 'blog_categories' => 'bc' ),
|
||||
'where' => "e.blog_id=bc.blog_id and e.category_id=bc.category_id",
|
||||
'type' => 'left'
|
||||
) ),
|
||||
'where' => "b.blog_id = ".intval($blog_id)." AND e.entry_status='published' ".$allowguests.$extra.$leveljoin,
|
||||
'order' => 'e.entry_date DESC',
|
||||
'limit' => array(0, intval($number_of_entries) )
|
||||
) );
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
$return_array = array();
|
||||
while ( $entry = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$entry['blog_url'] = $this->blog_std->get_blog_url( $entry['blog_id'], $entry['blog_friendly_url'] );
|
||||
$entry['entry_url'] = $entry['blog_url'].'eid='.$entry['entry_id'];
|
||||
$return_array[] = $entry;
|
||||
}
|
||||
return $return_array;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
|
||||
| > $Revision: 23 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Gallery last 5 submissions
|
||||
| > Module written by Brandon Farber
|
||||
| > Date started: Wednesday 7/26/2006
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Gallery
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
* To follow
|
||||
* </code>
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IPS_API_PATH' ) )
|
||||
{
|
||||
/**
|
||||
* Define classes path
|
||||
*/
|
||||
define( 'IPS_API_PATH', dirname(__FILE__) ? dirname(__FILE__) : '.' );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'api_core' ) )
|
||||
{
|
||||
require_once( IPS_API_PATH.'/api_core.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Gallery
|
||||
*
|
||||
* This class will pull the last 5 images a user has submitted to Gallery.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @version 2.1
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class api_gallery extends api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
//var $ipsclass;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Returns an array of gallery data
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Returns an array of gallery data
|
||||
*
|
||||
* @return array Array of gallery data
|
||||
*/
|
||||
function return_gallery_data( $member_id = 0, $limit = 5, $do_pull = 1 )
|
||||
{
|
||||
if( !$member_id )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Permissions?
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->ipsclass->vars['gallery_guest_access'] AND !$this->ipsclass->member['id'] )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$images = array();
|
||||
|
||||
$member_id = intval($member_id);
|
||||
|
||||
|
||||
$categories = $this->glib->get_allowed_cats( 0 );
|
||||
$albums = $this->glib->get_allowed_albums();
|
||||
|
||||
if( !count($categories) AND !count($albums) )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$where = array();
|
||||
$where_statement = "";
|
||||
|
||||
if( count($categories) )
|
||||
{
|
||||
$where[] = "i.category_id IN (".implode( ',', $categories ).")";
|
||||
}
|
||||
|
||||
if( count($albums) )
|
||||
{
|
||||
$where[] = "i.album_id IN (".implode( ",", $albums ).")";
|
||||
}
|
||||
|
||||
if( !count($where) )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_statement = implode( " OR ", $where );
|
||||
}
|
||||
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'i.*',
|
||||
'from' => array( 'gallery_images' => 'i' ),
|
||||
'where' => "i.member_id={$member_id} AND ({$where_statement})",
|
||||
'add_join' => array(
|
||||
1 => array( 'type' => 'left',
|
||||
'select' => 'a.name as album_name, a.public_album',
|
||||
'from' => array( 'gallery_albums' => 'a' ),
|
||||
'where' => 'a.id=i.album_id',
|
||||
),
|
||||
2 => array( 'type' => 'left',
|
||||
'select' => 'c.name as category_name',
|
||||
'from' => array( 'gallery_categories' => 'c' ),
|
||||
'where' => "c.id=i.category_id",
|
||||
),
|
||||
3 => array( 'type' => 'left',
|
||||
'select' => 'm.members_display_name as name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=i.member_id",
|
||||
),
|
||||
4 => array( 'type' => 'left',
|
||||
'select' => 'r.id as rated, r.rate as _my_rate',
|
||||
'from' => array( 'gallery_ratings' => 'r' ),
|
||||
'where' => "r.img_id=i.id AND r.member_id={$this->ipsclass->member['id']}",
|
||||
)
|
||||
),
|
||||
'order' => 'i.idate DESC',
|
||||
'limit' => array( 0, $limit )
|
||||
) );
|
||||
|
||||
$this->res = $this->ipsclass->DB->exec_query();
|
||||
|
||||
$this->total = $this->ipsclass->DB->get_num_rows( $this->res );
|
||||
//print_r($this->ipsclass->DB);
|
||||
|
||||
if( $do_pull )
|
||||
{
|
||||
while( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$images[] = $r;
|
||||
}
|
||||
|
||||
return $images;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
|
||||
| > $Revision: 23 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: IDM last 5 submissions
|
||||
| > Module written by Brandon Farber
|
||||
| > Date started: Thursday 7/27/2006
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: IDM
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
* To follow
|
||||
* </code>
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IPS_API_PATH' ) )
|
||||
{
|
||||
/**
|
||||
* Define classes path
|
||||
*/
|
||||
define( 'IPS_API_PATH', dirname(__FILE__) ? dirname(__FILE__) : '.' );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'api_core' ) )
|
||||
{
|
||||
require_once( IPS_API_PATH.'/api_core.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* API: IDM
|
||||
*
|
||||
* This class will pull the last 5 IDM submissions a user has submitted
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @version 2.1
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class api_idm extends api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
//var $ipsclass;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Returns an array of download data
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Returns an array of download data
|
||||
*
|
||||
* @return array Array of download data
|
||||
*/
|
||||
function return_idm_data( $member_id = 0, $limit = 5 )
|
||||
{
|
||||
if( !$member_id )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Permissions?
|
||||
//-----------------------------------------
|
||||
|
||||
if( !isset($this->ipsclass->vars['idm_online']) )
|
||||
{
|
||||
// IDM is not installed since the key doesn't exist
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
if( $this->ipsclass->vars['idm_online'] == 0 )
|
||||
{
|
||||
$offline_access = explode( ",", $this->ipsclass->vars['idm_offline_groups'] );
|
||||
|
||||
$my_groups = array( $this->ipsclass->member['mgroup'] );
|
||||
|
||||
if( $this->ipsclass->member['mgroups_other'] )
|
||||
{
|
||||
$my_groups = array_merge( $my_groups, explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroups_other'] ) ) );
|
||||
}
|
||||
|
||||
$continue = 0;
|
||||
|
||||
foreach( $my_groups as $group_id )
|
||||
{
|
||||
if( in_array( $group_id, $offline_access ) )
|
||||
{
|
||||
$continue = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( $continue == 0 )
|
||||
{
|
||||
// Offline, and we don't have access
|
||||
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$files = array();
|
||||
|
||||
$member_id = intval($member_id);
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab allowed categories
|
||||
//-----------------------------------------
|
||||
|
||||
if( !file_exists( ROOT_PATH.'modules/downloads/lib/lib_cats.php' ) )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
require ( ROOT_PATH.'modules/downloads/lib/lib_cats.php' );
|
||||
$this->catlib = new lib_cats();
|
||||
$this->catlib->ipsclass = & $this->ipsclass;
|
||||
$this->catlib->normal_init();
|
||||
$this->catlib->get_member_cat_perms( );
|
||||
|
||||
$categories = $this->catlib->member_access['view'];
|
||||
|
||||
if( !is_array($categories) OR !count($categories) )
|
||||
{
|
||||
//No category permissions
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'f.*',
|
||||
'from' => array( 'downloads_files' => 'f' ),
|
||||
'where' => 'f.file_submitter='.$member_id.' AND f.file_open=1 AND f.file_cat IN ('.implode( ',', $categories ).')',
|
||||
'add_join' => array(
|
||||
1 => array( 'type' => 'left',
|
||||
'select' => 'c.cname as category_name',
|
||||
'from' => array( 'downloads_categories' => 'c' ),
|
||||
'where' => "c.cid=f.file_cat",
|
||||
)
|
||||
),
|
||||
'order' => 'f.file_submitted DESC',
|
||||
'limit' => array( 0, $limit )
|
||||
) );
|
||||
|
||||
$res = $this->ipsclass->DB->exec_query();
|
||||
|
||||
while( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$files[] = $r;
|
||||
}
|
||||
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,15 +0,0 @@
|
||||
<html>
|
||||
<head><title>Ошибка < Русская версия Invision Power Board</title></head>
|
||||
<body>
|
||||
<h1>Ошибка < Русская версия Invision Power Board</h1>
|
||||
<hr>
|
||||
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку «<b>Назад</b>»
|
||||
в вашем браузере для возвращения на предыдущую страницу.
|
||||
<hr>
|
||||
<b>Invision Power Board:</b>
|
||||
<ul>
|
||||
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
|
||||
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user