Version 2.3.6

This commit is contained in:
Neo committed 2025-12-19 00:26:08 -08:00
1 parent a3bb603c96
commit 19b38c7c74
764 files changed
+143731 -118164

No files matched your search

+58 -77
View File
@@ -2,27 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.2.2
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Monday 05th of March 2007 10:10:54 PM
| Release: e3790216629e5a2aaf37070b32237f06
| 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-10-26 14:14:27 -0500 (Thu, 26 Oct 2006) $
| > $Revision: 679 $
| > $Date: 2007-07-13 13:51:38 -0400 (Fri, 13 Jul 2007) $
| > $Revision: 1087 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
@@ -34,25 +24,25 @@
*/
/**
* API: Êîìïîíåíòîâ ôîðóìà
* API: Components
*
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
* EXAMPLE USAGE
* <code>
* //-- ÎÁÍÎÂËÅÍÈÅ ÑÓÙÅÑÒÂÓÞÙÅÃÎ ÊÎÌÏÎÍÅÍÒÀ --//
* //-- UPDATE EXISTING ROW --//
* $api = new api_components();
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
* # Optional - if $ipsclass is not passed, it'll init
* $api->ipsclass =& $this->ipsclass;
* $api->api_init();
* $update = array (
* 'com_version' => '1.3',
* 'com_menu_data' => array( 0 => array(
* 'menu_text' => 'Íàçâàíèå ïóíêòà ìåíþ',
* 'menu_text' => 'Link text',
* 'menu_url' => 'code=showme',
* 'menu_redirect' => 0,
* 'menu_permbit' => 'keyhere',
* 'menu_permlang' => 'Ïîçâîëÿåò ñîçäàòü ÷òî-òî' ),
* 'menu_permlang' => 'Allow CREATE Something' ),
* 1 => array(
* 'menu_text' => 'Íàçâàíèå ïóíêòà ìåíþ 2',
* 'menu_text' => 'Link text 2',
* 'menu_url' => 'section=tools&act=op&code=showme2',
* 'menu_redirect' => 1,
* 'menu_permbit' => 'add',
@@ -60,23 +50,23 @@
* ) );
*
* $api->acp_component_update( 'blog', $update );
* //-- ÂÊËÞ×ÅÍÈÅ ÊÎÌÏÎÍÅÍÒÀ --//
* //-- ENABLE A COMPONENT --//
* $api->acp_component_enable( 'blog' );
* </code>
*
* ÏÎËß ÊÎÌÏÎÍÅÍÒ (ÑÒÐÓÊÒÓÐÀ ÊÎÌÏÎÍÅÍÒ)
* COMPONENT FIELDS
* <code>
* 'com_title' = Íàçâàíèå êîìïîíåíòà
* 'com_author' = Àâòîð êîìïîíåíòà
* 'com_version' = Âåðñèÿ êîìïîíåíòà
* 'com_url' = Àäðåñ ñàéòà êîìïîíåíòà
* 'com_menu_data' = Ìàññèâ ïóíêòîâ ìåíþ íàñòðîåê êîìïîíåíòà
* 'com_enabled' = Ñòàòóñ êîìïîíåíòà (âêëþ÷åí/íå âêëþ÷åí)
* 'com_safemode' = Ðåæèì ðàáîòû êîìïîíåíòà (åñëè â safemode àäìèíû íå ìîãóò èçìåíÿòü)
* 'com_section_key' = Óíèêàëüíûé êëþ÷ êîìïîíåíòà (Êëþ÷, ñîîòâåòñòâóþùèé íàçâàíèþ ôàéëà, íàïð-ð: blog åñëè èñïîëüçóåòñÿ blog.php)
* 'com_description' = Îïèñàíèå êîìïîíåíòà
* 'com_url_uri' = URI-àäðåñ êîìïîíåíòà â âåðõíåì ìåíþ ôîðóìà
* 'com_url_title' = Íàçâàíèå êîìïîíåíòà â âåðõíåì ìåíþ ôîðóìà
* 'com_title' = Component Title
* 'com_author' = Component Author
* 'com_version' = Component Version
* 'com_url' = Component Home URL
* 'com_menu_data' = Component Menu Data Array
* 'com_enabled' = Component Enabled
* 'com_safemode' = Component Safemode (admins cannot alter)
* 'com_section_key' = Component Section (Key, must match filename. eg: blog if using blog.php)
* 'com_description' = Component Description
* 'com_url_uri' = Component Board Header URL URI
* 'com_url_title' = Component Board Header URL Title
* </code>
*
* @package InvisionPowerBoard
@@ -105,9 +95,9 @@ if ( ! defined('IPS_API_CORE_LOADED') )
}
/**
* API: Êîìïîíåíòîâ ôîðóìà
* API: Components
*
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ ðàáîòû ñ êîìïîíåíòàìè ôîðóìà.
* This class deals with all available components functions.
*
* @package InvisionPowerBoard
* @subpackage APIs
@@ -118,27 +108,27 @@ if ( ! defined('IPS_API_CORE_LOADED') )
class api_components extends api_core
{
/**
* Èíôîðìàöèÿ î êîìïîíåíòå
* Loaded component
*
* @var array
*/
var $component;
/**
* Îáúåêò XML ïàðñåðà
* XML Parser Object
*
* @var object
*/
var $xml;
/*-------------------------------------------------------------------------*/
// Ïîëó÷åíèå èíôîðìàöèè î êîìïîíåíòå ïî åãî êëþ÷ó (èìåíè ñåêöèè êîìïîíåíòà)
// Get component by key
/*-------------------------------------------------------------------------*/
/**
* Ïîëó÷àåò âñþ èíôîðìàöèþ î êîìïîíåíòå
* Updates a component
*
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: blog)
* @return void Çàïîëíÿåò $this->component
* @param string Component key (eg: blog)
* @return void Populates $this->component
*/
function get_component_by_key( $key )
{
@@ -148,10 +138,10 @@ class api_components extends api_core
}
/*-------------------------------------------------------------------------*/
// Ñîçäàíèå ìåíþ
// Create menu
/*-------------------------------------------------------------------------*/
/**
* Ñîçäàåò ñåðèàëèçîâàííóþ ñòðîêó èç ìàññèâà ìåíþ
* Creates serialized string from a menu array
* <code>
* $menu_data [ $item_id ]['menu_text']
* $menu_data [ $item_id ]['menu_url']
@@ -160,8 +150,8 @@ class api_components extends api_core
* $menu_data [ $item_id ]['menu_permlang']
* </code>
*
* @param array ìíîãîóðîâíåâûé ìàññèâ
* @return string ñåðèàëèçîâàííûé ìàññèâ
* @param array multi-dimenisonal array
* @return void;
*/
function acp_component_create_menu_data( $menu_data )
{
@@ -173,12 +163,12 @@ class api_components extends api_core
/*-------------------------------------------------------------------------*/
// Èìïîðòèðîâàíèå êîìïîíåíò èç XML ôàéëà
// Import XML File
/*-------------------------------------------------------------------------*/
/**
* Îáíîâëÿåò/äîáàâëÿåò êîìïîíåíòû èç xml ôàéëà
* Updates/inserts a component from xml file
*
* @param string Ïóòü ê XML ôàéëó
* @param string Path to XML File
* @return array;
*/
function acp_component_import( $xml_file_path )
@@ -218,7 +208,6 @@ class api_components extends api_core
require_once( KERNEL_PATH.'class_xml.php' );
$this->xml = new class_xml();
$this->xml->lite_parser = 1;
//-----------------------------------------
// Unpack the datafile
@@ -239,11 +228,7 @@ class api_components extends api_core
// 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;
$this->xml->xml_array['componentexport']['componentgroup']['component'] = array( 0 => $this->xml->xml_array['componentexport']['componentgroup']['component'] );
}
$updated = $inserted = 0;
@@ -287,14 +272,13 @@ class api_components extends api_core
}
/*-------------------------------------------------------------------------*/
// Äîáàâëåíèå êîìïîíåíòà
// Update component
/*-------------------------------------------------------------------------*/
/**
* Äîáàâëÿåò íîâûé êîìïîíåíò â ñèñòåìó
* Updates a component
*
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: áëîã)
* @param array Ìàññèâ îáíîâëÿåìûõ ïîëåé ( äîëæåí ñîâïàäàòü ñî ñòðóêòóðîé
* êîìïîíåíò, ñì. â êîììåíòàðèÿõ ê ýòîìó êëàññó )
* @param string Component key (eg: blog)
* @param array Component fields ( must match class fields, see class docs )
* @return void;
*/
function acp_component_insert( $key, $fields )
@@ -386,14 +370,13 @@ class api_components extends api_core
}
/*-------------------------------------------------------------------------*/
// Îáíîâëåíèå êîìïîíåíòà
// Update component
/*-------------------------------------------------------------------------*/
/**
* Îáíîâëÿåò ñëæåáíóþ èíôîðìàöèþ êîìïîíåíòà
* Updates a component
*
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: áëîã)
* @param array Ìàññèâ îáíîâëÿåìûõ ïîëåé ( äîëæåí ñîâïàäàòü ñî ñòðóêòóðîé
* êîìïîíåíò, ñì. â êîììåíòàðèÿõ ê ýòîìó êëàññó )
* @param string Component key (eg: blog)
* @param array Component fields ( must match class fields, see class docs )
* @return void;
*/
function acp_component_update( $key, $fields )
@@ -492,13 +475,12 @@ class api_components extends api_core
}
/*-------------------------------------------------------------------------*/
// Óäàëåíèå êîìïîíåíòà
// Remove component
/*-------------------------------------------------------------------------*/
/**
* Óäàëÿåò êîìïîíåíò èç ñèñòåìó [ Âíèìàíèå, ìåòîä íå ïåðäîñòàâëÿåò
* íè êàêèõ ïîäòâåðæäåíèé óäàëåíèÿ ! ]
* Remove a component [ no confirmation screens! ]
*
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: blog)
* @param string Component key (eg: blog)
* @return void
*/
function acp_component_remove( $key )
@@ -508,13 +490,12 @@ class api_components extends api_core
}
/*-------------------------------------------------------------------------*/
// Âêëþ÷åíèå êîìïîíåíòà
// Enable component
/*-------------------------------------------------------------------------*/
/**
* Àêòèâèðóåò êîìïîíåíò - îí ñòàíîâèòñÿ äîñòóïíûì â ïîëüçîâàòåëüñêîé ÷àñòè
* ôîðóìà
* Enable a component
*
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: blog)
* @param string Component key (eg: blog)
* @return void
*/
function acp_component_enable( $key )
@@ -524,12 +505,12 @@ class api_components extends api_core
}
/*-------------------------------------------------------------------------*/
// Îòêëþ÷åíèå êîìïîíåíòà
// Disable component
/*-------------------------------------------------------------------------*/
/**
* Äåàêòèâèðóåò êîìïîíåíò
* Enable a component
*
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: blog)
* @param string Component key (eg: blog)
* @return void
*/
function acp_component_disable( $key )
@@ -539,10 +520,10 @@ class api_components extends api_core
}
/*-------------------------------------------------------------------------*/
// Ïåðåñòðîéêà êåøà êîìïîíåíòîâ
// Components Rebuild Cache
/*-------------------------------------------------------------------------*/
/**
* Ñîçäàåò íîâûé êåø êîìïîíåíòîâ
* Rebuild cache
*
* @return void
*/
+39 -58
View File
@@ -2,27 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.2.2
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Monday 05th of March 2007 10:10:54 PM
| Release: e3790216629e5a2aaf37070b32237f06
| 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-09-22 05:28:54 -0500 (Fri, 22 Sep 2006) $
| > $Revision: 567 $
| > $Date: 2007-06-26 11:58:29 -0400 (Tue, 26 Jun 2007) $
| > $Revision: 1066 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
@@ -34,16 +24,17 @@
*/
/**
* API: ßÄÐÎ
* API: CORE
*
* Äàííûé êëàññ ñîäåðæèò âñå áàçîâûå ôóíêöèè, à òàêæå âñå ôóíêöèè ïî ðàáîòå
* ñ ÿçûêàìè.
* Åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò êëàññà, òî îáúåêò ipsclass
* èíèöèàëèçèðóåòñÿ àâòîìàòè÷åñêèþ, çàãðóæàþòñÿ âñå íåîáõîäèìûå áàçîâûå êëàññû
* è èíèöèàëèçèðóþòñÿ èõ îáúåêòû (DB, converge, forums, display, session).
* Ñîçäàåòñÿ íîâîå ïîäêëþ÷åíèå ê ÁÄ, çàãðóæàþòñÿ âñå íåîáõîäèìûå êåøè.
* Âû ìîæåòå óïðàâëÿòü ïîäêëþ÷åíèåì êëàññîâ ÷åðåç ìàññèâ
* $this->load_classes[-class-] = 1;
* This class deals with all core functions.
* This class deals with all available language functions.
* If $ipsclass is passed to it, then it will skip the init
* However, if $ipsclass is not an object, it'll initialize
* the $ipsclass object, and by default load all the required
* IPB classes and init them (DB, converge, forums, display, session)
* and it'll also get a new DB connection and load settings and caches.
* You can alter which classes are loaded via the $this->load_classes[-class-] = 1;
* array
*
* @package InvisionPowerBoard
* @subpackage APIs
@@ -53,9 +44,9 @@
*/
/**
* API: ßÄÐÎ
* API: CORE
*
* Êëàññ ïðåäîñòàâëÿåò âñå áàçîâûå ìåòîäû API.
* This class deals with all core functions.
*
* @package InvisionPowerBoard
* @subpackage APIs
@@ -66,7 +57,7 @@
class api_core
{
/**
* Îáúåêò ñóïåð-êëàññà IPS
* IPS Class Object
*
* @var object
*/
@@ -80,30 +71,30 @@ class api_core
var $init_run;
/**
* Ìàññèâ îøèáîê API
* API Error string
*
* @var array Errors
*/
var $api_error = array();
/**
* Ôëàã ïîëíîé çàãðóçêè API
* API Load full?
*
* @var integer boolean
*/
var $full_load = 1;
/**
* Êîðíåâîé ïóòü äëÿ API (ãäå íàõîäÿòñÿ ôàéëû init.php/index.php)
* API Path to IPB root (where init.php/index.php is)
*
* @var string Ïóòü ê êîðíåâîé äèðåêòîðèè IPB
* @var string Path to IPB root folder
*/
var $path_to_ipb = '../../';
/**
* Êëàññû äëÿ çàãðóçêè API
* API Load classes
*
* @var array Êëàññû çàãðóæàåìûå ïî óìîë÷àíèþ: [print,forums,converge,session]
* @var array Classes to load default: [print,forums,converge,session]
*/
var $load_classes = array( 'print' => 1,
'forums' => 1,
@@ -111,11 +102,11 @@ class api_core
'session' => 1 );
/*-------------------------------------------------------------------------*/
// Èíèöèàëèçàöèÿ API
// API init
/*-------------------------------------------------------------------------*/
/**
* Ïðîâåðêà íàëè÷èÿ íåîáõîäèìîãî îáúåêòà ipsclass è íåîáõîäèìîñòü ïîäêëþ÷åíèÿ
* íåîáõîäèìûõ êëàññîâ
* Determines if we have required ipsclass vars
* on hand
*
* @return void;
*/
@@ -198,18 +189,6 @@ class api_core
$this->ipsclass->sess->ipsclass =& $this->ipsclass;
}
//-------------------------------
// FORUMS Object?
//-------------------------------
if ( ! is_object( $this->ipsclass->forums ) AND $this->load_classes['forums'] )
{
require_once ROOT_PATH . "sources/classes/class_forums.php";
$this->ipsclass->forums = new forum_functions();
$this->ipsclass->forums->ipsclass =& $this->ipsclass;
}
//-------------------------------
// Converge Object?
//-------------------------------
@@ -230,29 +209,31 @@ class api_core
$this->ipsclass->init_load_cache( array('rss_export', 'bbcode', 'attachtypes', 'badwords', 'emoticons', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'languages', 'forum_cache', 'moderators', 'stats') );
}
//-------------------------------
// FORUMS Object?
//-------------------------------
if ( ! is_object( $this->ipsclass->forums ) AND $this->load_classes['forums'] )
{
require_once ROOT_PATH . "sources/classes/class_forums.php";
$this->ipsclass->forums = new forum_functions();
$this->ipsclass->forums->ipsclass =& $this->ipsclass;
$this->ipsclass->forums->strip_invisible = 1;
$this->ipsclass->forums->forums_init();
}
if ( ! defined('IPSCLASS_INITIATED') )
{
$this->ipsclass->initiate_ipsclass();
$this->ipsclass->md5_check = $ipsclass->return_md5_check();
$this->ipsclass->parse_incoming();
if ( ! is_object( $this->ipsclass->forums ) )
{
$this->ipsclass->forums->ipsclass =& $this->ipsclass;
$this->ipsclass->forums->strip_invisible = 1;
$this->ipsclass->forums->forums_init();
}
$this->ipsclass->load_skin();
}
$this->init_run = 1;
}
}
+100 -26
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.2.2
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Monday 05th of March 2007 10:10:54 PM
| Release: e3790216629e5a2aaf37070b32237f06
| 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 $
@@ -34,15 +24,11 @@
*/
/**
* API: Ôîðóìîâ
* API: Forums
*
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
* EXAMPLE USAGE
* <code>
* $api = new api_forums();
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
* $api->ipsclass =& $this->ipsclass;
* $api->api_init();
* $jump_list = $api->return_forum_jump_option_list( array(1,3,5) );
* To follow
* </code>
*
* @package InvisionPowerBoard
@@ -66,9 +52,9 @@ if ( ! class_exists( 'api_core' ) )
}
/**
* API: Ôîðóìîâ
* API: Languages
*
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ ïîëó÷åíèÿ ñïèñêà ôîðóìîâ.
* This class deals with all available language functions.
*
* @package InvisionPowerBoard
* @subpackage APIs
@@ -87,17 +73,28 @@ class api_forums extends api_core
/*-------------------------------------------------------------------------*/
// Ïîëó÷åíèå ñïèñêà ôîðóìîâ â âèäå ñïèñêà <option></option>
// Returns a forum jump option list
/*-------------------------------------------------------------------------*/
/**
* Âîçâðàùàåò ñïèñîê âñåõ ôîðóìîâ ÁÅÇ òåãà SELECT
* Âíèìàíèå: ìåòîä âîçâðàùàåò ÂÑÅ ôîðóìû áåç ó÷åòà ïðàâ äîñòóïà.
* Returns a forum jump list WITHOUT the SELECT tag
* NOTE: Returns ALL forums regardless of permission as
* if viewed from the ACP.
*
* @param array Ìàññèâ ID âûáðàííûõ ôîðóìîâ
* @return string HTML <option> ñïèñîê ôîðóìîâ;
* @param array Array of selected IDs
* @return string HTML <option> list of forums;
*/
function return_forum_jump_option_list( $selected=array() )
function return_forum_jump_option_list( $selected=array(), $view_as_guest=0 )
{
//-----------------------------------------
// Load up permissions...
//-----------------------------------------
if ( $view_as_guest )
{
$this->ipsclass->perm_id_array = explode( ',', $this->ipsclass->create_perms_from_group( $this->ipsclass->vars['guest_group'] ) );
$this->ipsclass->forums->strip_invisible = 1;
}
//-----------------------------------------
// Get forums...
//-----------------------------------------
@@ -125,6 +122,83 @@ class api_forums extends api_core
return $content;
}
/*-------------------------------------------------------------------------*/
// Returns all forum data
/*-------------------------------------------------------------------------*/
/**
* Return forum data
* NOTE: Returns ALL forums regardless of permission as
* if viewed from the ACP.
*
* @param array Array of forum IDs (Optional, if blank it will return all forums)
* @return string HTML <option> list of forums;
*/
function return_forum_data( $forum_ids=array(), $view_as_guest=0 )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$forums = array();
//-----------------------------------------
// Load up permissions...
//-----------------------------------------
if ( $view_as_guest )
{
$this->ipsclass->perm_id_array = explode( ',', $this->ipsclass->create_perms_from_group( $this->ipsclass->vars['guest_group'] ) );
$this->ipsclass->forums->strip_invisible = 1;
}
//-----------------------------------------
// Get forums...
//-----------------------------------------
$this->ipsclass->forums->forums_init();
foreach( $this->ipsclass->forums->forum_by_id as $id => $data )
{
if ( is_array( $forum_ids ) AND count( $forum_ids ) )
{
if ( in_array( $id, $forum_ids ) )
{
if ( $view_as_guest )
{
if ( ! $this->ipsclass->forums->forums_quick_check_access( $id ) )
{
$forums[] = $data;
}
}
else
{
$forums[] = $data;
}
}
}
else
{
if ( $view_as_guest )
{
if ( ! $this->ipsclass->forums->forums_quick_check_access( $id ) )
{
$forums[] = $data;
}
}
else
{
$forums[] = $data;
}
}
}
//-----------------------------------------
// Return...
//-----------------------------------------
return $forums;
}
+14 -24
View File
@@ -2,27 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.2.2
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Monday 05th of March 2007 10:10:54 PM
| Release: e3790216629e5a2aaf37070b32237f06
| 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-11-28 09:33:12 -0600 (Tue, 28 Nov 2006) $
| > $Revision: 742 $
| > $Date: 2007-05-15 17:56:24 -0400 (Tue, 15 May 2007) $
| > $Revision: 997 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
@@ -34,12 +24,12 @@
*/
/**
* API: ßçûêîâ
* API: Languages
*
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
* EXAMPLE USAGE
* <code>
* $api = new api_language();
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
* # Optional - if $ipsclass is not passed, it'll init
* $api->ipsclass =& $this->ipsclass;
* $api->api_init();
* $api->lang_add_strings( array('lang_key' => "Language value" ), 'lang_subscriptions' );
@@ -66,9 +56,9 @@ if ( ! class_exists( 'api_core' ) )
}
/**
* API: ßçûêîâ
* API: Languages
*
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ äîáàâëåíèÿ ÿçûêîâûõ êîíñòðóêöèé.
* This class deals with all available language functions.
*
* @package InvisionPowerBoard
* @subpackage APIs
@@ -87,14 +77,14 @@ class api_language extends api_core
/*-------------------------------------------------------------------------*/
// Äîáàâëåíèå ÿçûêîâûõ êîíñòðóêöèé â IPB
// Add language strings to IPB language system
/*-------------------------------------------------------------------------*/
/**
* Äîáàâëÿåò ÿçûêîâûå êîíñòðóêöèè ê ñèñòåìå ÿçûêîâ IPB
* Add language strings to the IPB language system
*
* @param array Ìàññèâ äîáàâëÿåìûõ êîíñòðóêöèé (ñòðóêòóðà ìàññèâà Êëþ÷ êîíñòðóêöèè => çíà÷åíèå)
* @param string ßçûêîâîé ôàéë, êóäà äîáàâëÿåòñÿ êîíñòðóêöèÿ, íàï-ð: lang_global
* @param string Ê êàêîìó ÿçûêîâîìó íàáîðó (ÿçûêó) äîáàâèòü êîíñòðóêöèþ ('all' âî âñå)
* @param array Language keys => values to add
* @param string Language file, eg: lang_global
* @param string Language pack to add to or 'all' to add to all
* @return void;
*/
function lang_add_strings( $to_add=array(), $add_lang_file='', $add_where='all')
@@ -146,7 +136,7 @@ class api_language extends api_core
}
else
{
$this->errors[] = "file_not_found";
$this->api_error[] = "file_not_found";
return;
}
+325
View File
@@ -0,0 +1,325 @@
<?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: Members
| > Module written by Matt Mecham
| > Date started: Wed 27th June 2007
|
+--------------------------------------------------------------------------
*/
/**
* API: Member
*
* EXAMPLE USAGE
* <code>
* $api = new api_member();
* # Optional - if $ipsclass is not passed, it'll init
* $api->ipsclass =& $this->ipsclass;
* $api->api_init();
* # Check for a member by email address
* $boolean = $api->check_for_member( 'email', 'foo@bar.com' );
* </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: Tasks
*
* This class deals with all available task insertion functions.
*
* @package InvisionPowerBoard
* @subpackage APIs
* @author Matt Mecham
* @version 2.2
* @since 2.3.2
*/
class api_member extends api_core
{
/**
* IPS Class Object
*
* @var object
*/
//var $ipsclass;
/*-------------------------------------------------------------------------*/
// Fetch Member
/*-------------------------------------------------------------------------*/
/**
* Return a member
*
* @param string Type of field to check
* @param string String to check
* @return boolean;
*/
function get_member( $type='email', $search_string='' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$query = '';
$return = array();
$skippy = array( 'legacy_password', 'member_login_key', 'member_login_key_expire', 'failed_logins', 'failed_login_count' );
//-----------------------------------------
// Decide what we're doing...
//-----------------------------------------
switch( $type )
{
case 'email':
case 'emailaddress':
case 'email_address':
$email_address = $this->ipsclass->clean_email( $this->ipsclass->parse_clean_value( strtolower( $search_string ) ) );
if ( $email_address )
{
$query = "m.email='" . $email_address . "'";
}
else
{
return FALSE;
}
break;
case 'id':
$query = "m.id='" . intval( $search_string ) . "'";
break;
case 'name':
case 'username':
case 'loginname':
$query = "m.members_l_username='" . $this->ipsclass->parse_clean_value( strtolower( $search_string ) ) . "'";
break;
case 'displayname':
case 'members_display_name':
$query = "m.members_l_display_name='" . $this->ipsclass->parse_clean_value( strtolower( $search_string ) ) . "'";
break;
}
//-----------------------------------------
// Search
//-----------------------------------------
if ( $query )
{
$this->ipsclass->DB->build_query( array( 'select' => 'm.*',
'from' => array( 'members' => 'm' ),
'where' => $query,
'add_join' => array( 0 => array( 'select' => 'me.*',
'from' => array( 'member_extra' => 'me' ),
'where' => 'me.id=m.id',
'type' => 'left' ),
1 => array( 'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=m.id',
'type' => 'left' ) ) ) );
$this->ipsclass->DB->exec_query();
$member = $this->ipsclass->DB->fetch_row();
if ( $member['id'] )
{
//-----------------------------------------
// Copy across *most* details...
//-----------------------------------------
foreach( $member as $k => $v )
{
if ( ! in_array( $k, $skippy ) )
{
$return[ $k ] = $v;
}
}
//-----------------------------------------
// Format some stuff?
//-----------------------------------------
$return['_avatar'] = $this->ipsclass->get_avatar( $member['avatar_location'], 1, $member['avatar_size'], $member['avatar_type'] );
$return['_joined'] = $this->ipsclass->get_date( $member['joined'], 'JOINED' );
//-----------------------------------------
// Check URL
//-----------------------------------------
$this->ipsclass->vars['img_url'] = ( ! $this->ipsclass->vars['img_url'] ) ? $this->ipsclass->vars['board_url'] . '/style_images/' . $this->ipsclass->skin['_imagedir'] : $this->ipsclass->vars['img_url'];
//-----------------------------------------
// Main photo
//-----------------------------------------
if ( ! $return['pp_main_photo'] )
{
$return['pp_main_photo'] = $this->ipsclass->vars['img_url'].'/folder_profile_portal/pp-blank-large.png';;
$return['pp_main_width'] = 150;
$return['pp_main_height'] = 150;
$return['_has_photo'] = 0;
}
else
{
$return['pp_main_photo'] = $this->ipsclass->vars['upload_url'] . '/' . $member['pp_main_photo'];
$return['_has_photo'] = 1;
}
//-----------------------------------------
// Thumbie
//-----------------------------------------
if ( ! $member['pp_thumb_photo'] )
{
if( $member['_has_photo'] )
{
$return['pp_thumb_photo'] = $member['pp_main_photo'];
}
else
{
$return['pp_thumb_photo'] = $this->ipsclass->vars['img_url'].'/folder_profile_portal/pp-blank-thumb.png';
}
$return['pp_thumb_width'] = 50;
$return['pp_thumb_height'] = 50;
}
else
{
$return['pp_thumb_photo'] = $this->ipsclass->vars['upload_url'] . '/' . $member['pp_thumb_photo'];
}
//-----------------------------------------
// Mini
//-----------------------------------------
$_data = $this->ipsclass->scale_image( array( 'max_height' => 25, 'max_width' => 25, 'cur_width' => $member['pp_thumb_width'], 'cur_height' => $member['pp_thumb_height'] ) );
$return['pp_mini_photo'] = $member['pp_thumb_photo'];
$return['pp_mini_width'] = $_data['img_width'];
$return['pp_mini_height'] = $_data['img_height'];
return $return;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
/*-------------------------------------------------------------------------*/
// Check if member exists
/*-------------------------------------------------------------------------*/
/**
* Checks to see if a member exists
*
* @param string Type of field to check
* @param string String to check
* @return boolean;
*/
function check_for_member( $type='email', $search_string='' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$query = '';
//-----------------------------------------
// Decide what we're doing...
//-----------------------------------------
switch( $type )
{
case 'email':
case 'emailaddress':
case 'email_address':
$email_address = $this->ipsclass->clean_email( $this->ipsclass->parse_clean_value( strtolower( $search_string ) ) );
if ( $email_address )
{
$query = "email='" . $email_address . "'";
}
else
{
return FALSE;
}
break;
case 'id':
$query = "id='" . intval( $search_string ) . "'";
break;
case 'name':
case 'username':
case 'loginname':
$query = "members_l_username='" . $this->ipsclass->parse_clean_value( strtolower( $search_string ) ) . "'";
break;
case 'displayname':
case 'members_display_name':
$query = "members_l_display_name='" . $this->ipsclass->parse_clean_value( strtolower( $search_string ) ) . "'";
break;
}
//-----------------------------------------
// Search
//-----------------------------------------
if ( $query )
{
$member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'id',
'from' => 'members',
'where' => $query ) );
if ( $member['id'] )
{
return TRUE;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
}
?>
+407 -424
View File
@@ -1,425 +1,408 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.2.2
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Monday 05th of March 2007 10:10:54 PM
| Release: e3790216629e5a2aaf37070b32237f06
| 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-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: Íàñòðîåê ôîðóìà
*
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
* <code>
* $api = new api_settings();
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
* $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: Íàñòðîåê ôîðóìà
*
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ äîáàâëåíèÿ íîâûõ íàñòðîåê.
*
* @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();
/*-------------------------------------------------------------------------*/
// Äîáàâëåíèå íàñòðîåê IPB (ñóùåñòâóþùèå íàñòðîéêè îáíîâëÿþòñÿ)
/*-------------------------------------------------------------------------*/
/**
* Äîáàâëÿåò èëè îáíîñëÿåò íàñòðîéêè IPB
*
* @param string Ïóòü ê xml ôàéëó ñ íàñòðîéêàìè
* @param array Ìàññèâ çíà÷åíèé ïî óìîë÷àíèþ íàñòðîåê
* (êëþ÷_íàñòðîéêè => çíà÷åíèå_ïî_óìîë÷àíèþ)
* @param array Ìàññèâ òåêóùèõ çíà÷åíèé íàñòðîåê
* (êëþ÷_íàñòðîéêè => òåêóùåå_çíà÷åíèå)
* @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();
$xml->lite_parser = 1;
//-------------------------------
// Get file contents
//-------------------------------
if( !file_exists( $xml_file_path ) )
{
$this->api_error[] = "invalid_file";
return;
}
$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', 'conf_title_module' );
//-----------------------------------------
// 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'],
'conf_title_module' => $data['conf_title_module'] );
//-----------------------------------------
// 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;
}
}
}
<?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
//-------------------------------
if( !file_exists( $xml_file_path ) )
{
$this->api_error[] = "invalid_file";
return;
}
$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_add_cache' , 'conf_title_keyword' );
$setting_fields = array( 'conf_title_keyword', 'conf_title_title', 'conf_title_desc', 'conf_title_noshow', 'conf_title_module' );
//-----------------------------------------
// Fix up...
//-----------------------------------------
if ( ! is_array( $this->xml->xml_array['settingexport']['settinggroup']['setting'][0] ) )
{
//-----------------------------------------
// Ensure [0] is populated
//-----------------------------------------
$this->xml->xml_array['settingexport']['settinggroup']['setting'] = array( 0 => $this->xml->xml_array['settingexport']['settinggroup']['setting'] );
}
//-----------------------------------------
// 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' => intval($data['conf_title_noshow']),
'conf_title_module' => $data['conf_title_module'] );
//-----------------------------------------
// 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;
}
}
}
?>
+511 -173
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.2.2
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Monday 05th of March 2007 10:10:54 PM
| Release: e3790216629e5a2aaf37070b32237f06
| 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-05-25 10:15:22 -0400 (Thu, 25 May 2006) $
| > $Revision: 278 $
@@ -34,12 +24,12 @@
*/
/**
* API: Ñòèëåé
* API: Skins
*
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
* EXAMPLE USAGE
* <code>
* $api = new api_skins();
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
* # Optional - if $ipsclass is not passed, it'll init
* $api->ipsclass =& $this->ipsclass;
* $api->api_init();
* $api->skin_add_bits( $path_to_xml_file );
@@ -49,36 +39,28 @@
* $messages = $api->skin_rebuild_caches( $messages[0] );
* </code>
*
* Ïðèìåð XML-ôàéëà ìàêðîñîâ ìîæíî ïîëó÷èòü ýêñïîðòðîâàíèåì èç
* ÀÖÏ ñ ïîìîùüþ èíñòðóìåíòà "Èìïîðò è ýêñïîðò ñòèëåé"
* Macros for use with this file can be exported via the ACP
* Skin Import/Export page
*
* XML-ôàéë ñ øàáëîíàìè ìîæíî ïîëó÷èòü ýêñïîðòðîâàíèåì èç ÀÖÏ â
* IN_DEV ðåæèìå. Íåîáõîäèìî çàéòè â Óïðàâëåíèå ñòèëÿìè ->
* Ñïèñîê ñòèëåé è âîñïîëüçîâàòüñÿ èíñòðóìåíòàìè èç ðàçäåëà
* Ýêñïîðòèðîâàíèå äàííûõ.
* 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.
*
* Òàê æå ìîæíî ýêñïîðòèðîâàòü øàáëîíû òîëüêî îïðåäåëåííîé ãðóïïû
* Ðåæèì ðàçðàáîò÷èêà: ýêñïîðòèðîâàíèå ôàéëîâ ñòèëÿ
* Íàïðèìåð åñëè âû õîòèòå âñå øàáëîíû ãðóïïû skin_links, òî
* ââåäèòå â ïîëå çíà÷åíèå 'links'
*
* Ìåòîä skin_rebuild_caches ïîçâîëÿåò ñîçäàòü íîâûå êåø ôàéëû (php
* ôàéëû ñòèëÿ íà äèñêå) äëÿ îäíîãî ñòèëÿ çà ðàç. Ìåòîä ïåðåñòðàèâàåò
* ñòèëü id êîòîðîãî âûøå, ÷åì id ïåðåäàííîãî â ôóíêöèþ.
* Ïðè ïåðâîì âûçîâå ìåòîäà, ïåðåäàâàéòå åìó íóëåâîé ïàðàìåòð íà âõîä.
* Âî âñåõ ïîñëåäóþùèõ âûçîâàõ ïîäàâàéòå íà âõîä 1-å çíà÷åíèå èç
* ìàññèâà (èíäåêñ 0), êîòîðûé áûë âîçâðàùåí ïðåäûäóùèì âûçîâîì ìåòîäà.
* Äàííûé ïîäõîä ïîçâîëÿåò ïåðåñòðàèâàòü âñå ñòèëè ôîðóìà è èçáåæàòü
* òàéì-àóòîâ ïðè âûïîëíåíèè ýòîé îïåðàöèè. Ñîâåòóåì èñïîëüçîâàòü ýòó
* îñîáåííîñòü â âàøèõ ñêðèïòàõ òàê - ñêðèïò äîëæåí äåëàòü ðèäåðåêò íà
* ñåáÿ ñàìîãî ïîñëå êàæäîãî ïåðåñòðîåíèÿ ñòèëÿ, ïðè ýòîì â ïàðàìåòðàõ
* ðåäèðåêòà íåîáõîäèìî ïåðåäàâàòü ðåçóëüòàò, êîòîðûé âåðíóë ìåòîä
* skin_rebuild_caches. Êîãäà ïåðâîå çíà÷åíèå â âåðíóâøåìñÿ ìàññèâå
* áóäåò èìåòü çíà÷åíèå 0 âñå øàáëîíû âñåõ ñòèëåé áóäóò ïåðåñòðîåíû,
* à çíà÷èò ìîæíî çàâåðøàòü ðàáîòó ñêðèïòà. Òàê æå âàæíî ïîìíèòü, ÷òî
* âòîðîå çíà÷åíèå â âîçâðàùàåìîì ìàññèâå (èíäåêñ 1) ñîäåðæèò ìàññèâ
* ñîîáùåíèé.
* 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
@@ -101,9 +83,9 @@ if ( ! class_exists( 'api_core' ) )
}
/**
* API: Ñòèëåé
* API: Skins
*
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ äîáàâëåíèÿ ñòèëåé.
* This class deals with all available skin insertion functions.
*
* @package InvisionPowerBoard
* @subpackage APIs
@@ -119,19 +101,388 @@ class api_skins extends api_core
* @var object
*/
//var $ipsclass;
var $xml;
var $xmlarchive;
var $cache_func;
var $skinadmin;
var $skin_id = 0;
function get_import_libs()
{
if( !is_object($this->xml) )
{
require_once( KERNEL_PATH.'class_xml.php' );
$this->xml = new class_xml();
$this->xml->doc_type = $this->ipsclass->vars['gb_char_set'];
$this->xml->use_doctype = 1;
$this->xml->lite_parser = 1;
}
if( !is_object($this->xmlarchive) )
{
require_once( KERNEL_PATH.'class_xmlarchive.php' );
$this->xmlarchive = new class_xmlarchive( KERNEL_PATH );
}
if( !is_object($this->skinadmin) )
{
require_once( ROOT_PATH . 'sources/action_admin/skin_import.php' );
$this->skinadmin = new ad_skin_import();
$this->skinadmin->ipsclass =& $this->ipsclass;
}
if( !is_object($this->cache_func) )
{
$this->ipsclass->DB->load_cache_file( ROOT_PATH.'sources/sql/'.SQL_DRIVER.'_api_queries.php', 'sql_api_queries' );
require_once( ROOT_PATH.'sources/lib/admin_cache_functions.php' );
$this->cache_func = new admin_cache_functions();
$this->cache_func->ipsclass =& $this->ipsclass;
}
}
/*-------------------------------------------------------------------------*/
// Äîáàâëåíèå øàáëîíîâ ñòèëÿ IPB
// Add skin set to IPB
/*-------------------------------------------------------------------------*/
/**
* Äîáàâëÿåò øàáëîíû â ãëàâíûé ñòèëü IPB, øàáëîíû ïîòîì äîñòóïíû è ñòèëÿì-íàñëåäíèêàì
* Adds an entire skin set to IPB
*
* @param string Ïóòü ê xml, ñîäåðæàùåìó øàáëîíû (Ïîäñêàçêà: ïðèìåð xml
* ìîæíî ïîëó÷èòü ýêñïîðòðîâàíèåì èç ÀÖÏ â IN_DEV ðåæèìå)
* @param string Path to xml or xml.gz file containing skin set
* @return void;
*/
function skin_add_set( $xml_file_path )
{
//-------------------------------
// Check?
//-------------------------------
if ( ! $xml_file_path OR !file_exists($xml_file_path) )
{
$this->api_error[] = "input_missing_fields";
return;
}
if ( preg_match( "#\.gz$#", $xml_file_path ) )
{
if ( $FH = @gzopen( $xml_file_path, 'rb' ) )
{
while ( ! @gzeof( $FH ) )
{
$content .= @gzread( $FH, 1024 );
}
@gzclose( $FH );
}
}
else
{
if ( $FH = @fopen( $xml_file_path, 'rb' ) )
{
$content = @fread( $FH, filesize($xml_file_path) );
@fclose( $FH );
}
}
if( !$content )
{
$this->api_error[] = "xml_file_not_valid";
return;
}
$tmp_name = str_replace( ".gz", '', $xml_file_path );
$this->get_import_libs();
$this->xmlarchive->xml_read_archive_data( $content );
//-------------------------------
// Get file contents
//-------------------------------
$import_xml = array();
foreach( $this->xmlarchive->file_array as $f )
{
$import_xml[ $f['filename'] ] = $f['content'];
}
if ( $import_xml[ 'ipb_info.xml' ] != '' )
{
$info_xml = $this->skinadmin->_extract_xml_info( $import_xml[ 'ipb_info.xml' ], $this->xml, $this->xmlarchive );
}
if ( ! is_array( $info_xml ) and ! count( $info_xml ) )
{
$this->api_error[] = "xml_file_not_valid";
return;
}
if ( $import_xml[ 'ipb_templates.xml' ] != '' )
{
$templates_xml = $this->skinadmin->_extract_xml_templates( $import_xml[ 'ipb_templates.xml' ], $this->xml, $this->xmlarchive );
}
if ( $import_xml[ 'ipb_css.xml' ] != '' )
{
$css_xml = $this->skinadmin->_extract_xml_css( $import_xml[ 'ipb_css.xml' ], $this->xml, $this->xmlarchive );
}
if ( $import_xml[ 'ipb_macro.xml' ] != '' )
{
$macro_xml = $this->skinadmin->_extract_xml_macros( $import_xml[ 'ipb_macro.xml' ], $this->xml, $this->xmlarchive );
}
if ( $import_xml[ 'ipb_wrapper.xml' ] != '' )
{
$wrapper_xml = $this->skinadmin->_extract_xml_wrapper( $import_xml[ 'ipb_wrapper.xml' ], $this->xml, $this->xmlarchive );
}
$default = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_default=1' ) );
$img_dir = $default['set_image_dir'];
//-----------------------------------------
// Add new skin!
//-----------------------------------------
$this->ipsclass->DB->allow_sub_select = 1;
$this->ipsclass->DB->do_insert( 'skin_sets', array( 'set_name' => $info_xml['set_name'],
'set_hidden' => 0,
'set_default' => 0,
'set_css_method' => $default['set_css_method'],
'set_skin_set_parent' => -1,
'set_author_email' => $info_xml['set_author_email'],
'set_author_name' => $info_xml['set_author_name'],
'set_author_url' => $info_xml['set_author_url'],
'set_key' => $info_xml['set_key'],
'set_css' => $css_xml,
'set_wrapper' => $wrapper_xml,
'set_css_updated' => time(),
'set_emoticon_folder' => $default['set_emoticon_folder'],
'set_image_dir' => $img_dir
) );
$this->skin_id = $this->ipsclass->DB->get_insert_id();
//-----------------------------------------
// Insert templates...
//-----------------------------------------
if ( is_array( $templates_xml ) and count( $templates_xml ) )
{
foreach( $templates_xml as $t )
{
$this->ipsclass->DB->allow_sub_select = 1;
$this->ipsclass->DB->do_insert( 'skin_templates', array( 'set_id' => $this->skin_id,
'group_name' => $t['group_name'],
'section_content' => $t['section_content'],
'func_name' => $t['func_name'],
'func_data' => $t['func_data'],
'group_names_secondary' => $t['group_names_secondary'],
'updated' => time(),
'can_remove' => 1,
) );
}
}
//-----------------------------------------
// Insert Macros
//-----------------------------------------
if ( is_array( $macro_xml ) and count( $macro_xml ) )
{
foreach( $macro_xml as $t )
{
if ( ! $t['macro_value'] and ! $t['macro_replace'] )
{
continue;
}
$this->ipsclass->DB->allow_sub_select = 1;
$this->ipsclass->DB->do_insert( 'skin_macro', array( 'macro_set' => $this->skin_id,
'macro_value' => $t['macro_value'],
'macro_replace' => $t['macro_replace'],
'macro_can_remove' => 1,
) );
}
}
$this->ipsclass->DB->load_cache_file( ROOT_PATH.'sources/sql/'.SQL_DRIVER.'_api_queries.php', 'sql_api_queries' );
$this->cache_func->_rebuild_all_caches( array($this->skin_id) );
}
/*-------------------------------------------------------------------------*/
// Add image set to IPB
/*-------------------------------------------------------------------------*/
/**
* Adds an image set to IPB, using $skin_id or $this->skin_id as skin
*
* @param string Path to xml or xml.gz file containing image set
* @return void;
*/
function images_add_set( $xml_file_path, $skin_id=0 )
{
//-------------------------------
// Check?
//-------------------------------
if( $skin_id )
{
$this->skin_id = $skin_id;
}
if ( ! $xml_file_path OR !file_exists($xml_file_path) )
{
$this->api_error[] = "input_missing_fields";
return;
}
if ( preg_match( "#\.gz$#", $xml_file_path ) )
{
if ( $FH = @gzopen( $xml_file_path, 'rb' ) )
{
while ( ! @gzeof( $FH ) )
{
$content .= @gzread( $FH, 1024 );
}
@gzclose( $FH );
}
}
else
{
if ( $FH = @fopen( $xml_file_path, 'rb' ) )
{
$content = @fread( $FH, filesize($xml_file_path) );
@fclose( $FH );
}
}
if( !$content )
{
$this->api_error[] = "xml_file_not_valid";
return;
}
$tmp_name = str_replace( ".gz", '', $xml_file_path );
$this->get_import_libs();
$this->xmlarchive->xml_read_archive_data( $content );
//-------------------------------
// Get file contents
//-------------------------------
$default = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id=' . $this->skin_id ) );
$safename = substr( str_replace( " ", "", strtolower( preg_replace( "[^a-zA-Z0-9]", "", $default['set_name'] ) ) ), 0, 10 );
$images = array();
foreach( $this->xmlarchive->file_array as $f )
{
if ( $f['content'] and $f['filename'] )
{
$images[] = array( 'content' => $f['content'],
'path' => $f['path'],
'filename' => $f['filename']
);
}
}
if ( ! count($images) )
{
$this->api_error[] = "xml_file_not_valid";
return;
}
if ( ! is_writable( CACHE_PATH.'style_images' ) )
{
$this->api_error[] = "cache_path_not_writable";
return;
}
if ( file_exists( CACHE_PATH.'style_images/'.$safename ) )
{
$safename .= time();
}
if ( ! @mkdir( CACHE_PATH.'style_images/'.$safename, 0777 ) )
{
$this->api_error[] = "cache_path_not_writable";
return;
}
else
{
@chmod( CACHE_PATH.'style_images/'.$safename, 0777 );
}
foreach( $images as $id => $data )
{
//-----------------------------------------
// Do we have a duuuur?
//-----------------------------------------
if ( $data['path'] )
{
if ( ! file_exists( CACHE_PATH.'style_images/'.$safename.'/'.$data['path'] ) )
{
@mkdir( CACHE_PATH.'style_images/'.$safename.'/'.$data['path'], 0777 );
@chmod( CACHE_PATH.'style_images/'.$safename.'/'.$data['path'], 0777 );
}
$data['filename'] = $data['path'] . '/'. $data['filename'];
}
$content = $data['content'];
if ( $content )
{
if ( $FH = @fopen( CACHE_PATH.'style_images/'.$safename.'/'.$data['filename'], 'wb' ) )
{
if ( @fwrite( $FH, $content ) )
{
@fclose( $FH );
}
@chmod( CACHE_PATH.'style_images/'.$safename.'/'.$data['filename'], 0777 );
}
}
}
//-----------------------------------------
// Apply to a skin?
//-----------------------------------------
if( $this->skin_id )
{
$this->ipsclass->DB->do_update( 'skin_sets', array( 'set_image_dir' => $safename ), 'set_skin_set_id='.$this->skin_id );
$this->cache_func->_rebuild_all_caches( array($this->skin_id) );
}
}
/*-------------------------------------------------------------------------*/
// 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 )
@@ -139,57 +490,52 @@ class api_skins extends api_core
//-------------------------------
// Check?
//-------------------------------
if ( ! $xml_file_path )
if ( ! $xml_file_path OR !file_exists($xml_file_path) )
{
$this->api_error[] = "input_missing_fields";
return;
}
require_once( KERNEL_PATH.'class_xml.php' );
$this->xml = new class_xml();
$this->xml->lite_parser = 1;
//-------------------------------
// Get file contents
//-------------------------------
//-------------------------------
$skin_content = implode( "", file($xml_file_path) );
//-------------------------------
// Unpack the datafile (TEMPLATES)
//-------------------------------
$this->xml->xml_parse_document( $skin_content );
$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;
}
if ( ! is_array( $this->xml->xml_array['templateexport']['templategroup']['template'][0] ) )
{
//-----------------------------------------
// Ensure [0] is populated
//-----------------------------------------
$tmp = $this->xml->xml_array['templateexport']['templategroup']['template'];
unset($this->xml->xml_array['templateexport']['templategroup']['template']);
$this->xml->xml_array['templateexport']['templategroup']['template'][0] = $tmp;
$this->xml->xml_array['templateexport']['templategroup']['template'] = array( 0 => $this->xml->xml_array['templateexport']['templategroup']['template'] );
}
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"
@@ -198,7 +544,7 @@ class api_skins extends api_core
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()
@@ -208,27 +554,28 @@ class api_skins extends api_core
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'],
'group_names_secondary' => $entry['group_names_secondary']['VALUE'],
'updated' => time(),
'set_id' => 1
) );
}
}
}
/*-------------------------------------------------------------------------*/
// Äîáàâëåíèå ìàêðîñîâ IPB
// Add macros to IPB
/*-------------------------------------------------------------------------*/
/**
* Äîáàâëÿåò ìàêðîñû â ãëàâíûé ñòèëü IPB, ìàêðîñû ïîòîì äîñòóïíû è ñòèëÿì-íàñëåäíèêàì
* Adds macros to IPB master templates which will filter down to child skins
*
* @param string Ïóòü ê xml, ñîäåðæàùåìó ìàêðîñû (Ïîäñêàçêà: ïðèìåð xml
* ìîæíî ïîëó÷èòü ýêñïîðòðîâàíèåì èç ÀÖÏ â IN_DEV ðåæèìå)
* @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 )
@@ -236,44 +583,29 @@ class api_skins extends api_core
//-------------------------------
// Check?
//-------------------------------
if ( !$xml_file_path )
{
$this->api_error[] = "input_missing_fields";
return;
}
require_once( KERNEL_PATH.'class_xml.php' );
$this->xml = new class_xml();
$this->xml->lite_parser = 1;
//-------------------------------
// Get file contents
//-------------------------------
//-------------------------------
$macro_content = implode( "", file($xml_file_path) );
//-------------------------------
// Unpack the datafile (MACROS)
//-------------------------------
$this->xml->xml_parse_document( $macro_content );
if ( ! is_array( $this->xml->xml_array['macroexport']['macrogroup']['macro'][0] ) )
{
//-----------------------------------------
// Ensure [0] is populated
//-----------------------------------------
$tmp = $this->xml->xml_array['macroexport']['macrogroup']['macro'];
unset($this->xml->xml_array['macroexport']['macrogroup']['macro']);
$this->xml->xml_array['macroexport']['macrogroup']['macro'][0] = $tmp;
}
$this->xml->xml_parse_document( $macro_content );
//-------------------------------
// (MACRO)
//-------------------------------
@@ -283,11 +615,20 @@ class api_skins extends api_core
$this->api_error[] = "xml_file_not_valid";
return;
}
if ( ! is_array( $this->xml->xml_array['macroexport']['macrogroup']['macro'][0] ) )
{
//-----------------------------------------
// Ensure [0] is populated
//-----------------------------------------
$this->xml->xml_array['macroexport']['macrogroup']['macro'] = array( 0 => $this->xml->xml_array['macroexport']['macrogroup']['macro'] );
}
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"
@@ -295,38 +636,35 @@ class api_skins extends api_core
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
/*-------------------------------------------------------------------------*/
/**
* Ñîçäàåò íîâûå .php ôàéëû êåøà äëÿ øàáëîíîâ ñòèëÿ.
* Rebuilds template caches to cache new skins to .php files
*
* @param int id ïîñëåäíåãî ïåðåñîçäàííîãî ñòèëÿ
* @return array Âîçâðàùàåò ìàññèâ, ñîäåðæàùèé:
* - id îáðàáîòàííîãî ñòèëÿ (è ñíîâà ìîæåò áûòü ïåðåäàíî
* íà âõîä ýòîé ôóíêöèè äëÿ ïðîäîëæåíèÿ îáíîâëåíèÿ êåøåé äðóãèõ
* ñòèëåé)
* - ìàññèâ ñîîáùåíèé
* @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
//-----------------------------------
@@ -334,26 +672,26 @@ class api_skins extends api_core
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
//-----------------------------------
@@ -381,62 +719,62 @@ class api_skins extends api_core
}
else
{
return array( 'completed' => 0, 'messages' => array( 'Íåò áîëüøå ñòèëåé äëÿ ïåðåñîçäàíèÿ êåøà' ) );
return array( 'completed' => 0, 'messages' => array( 'No more skins to rebuild' ) );
}
}
}
/*-------------------------------------------------------------------------*/
// Îáíîâëåíèå êåøà øàáëîíîâ äî íîâîé âåðñèè
// Rebuild update template bit
/*-------------------------------------------------------------------------*/
/**
* Îáíîâëÿåò øàáëîíû ïðåäûäóùåé âåðñèè äî òåêóùåé
* Ïðèìå÷àíèå: ìåòîä èçìåíÿåò òîëüêî ôîðìàò øàáëîíîâ, íî íå èçìåíÿåò ñàì HTML
* øàáëîíîâ
* 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 HTML-òåëî øàáëîíà
* @return string 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===================================================";
@@ -445,21 +783,21 @@ class api_skins extends api_core
$_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
@@ -476,18 +814,18 @@ class api_skins extends api_core
//-----------------------------------------
// INIT
//-----------------------------------------
$if = '';
$if_html = '';
$else_if = '';
$else_if_html = '';
$else_html = '';
$formatted = '';
//-----------------------------------------
// What are we doing?
//-----------------------------------------
if ( count( $matches ) == 6 )
{
$if = trim( $matches[1] );
@@ -509,11 +847,11 @@ class api_skins extends api_core
$if_html = trim( $matches[2] );
$else_html = trim( $matches[3] );
}
//-----------------------------------------
// OK...
//-----------------------------------------
if ( $if AND $else_if AND $else_html )
{
$formatted = "<".$if.">\n";
@@ -544,18 +882,18 @@ class api_skins extends api_core
$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 );
@@ -564,42 +902,42 @@ class api_skins extends api_core
{
$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 );
$code = str_replace( '$($', '($', $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;
}
}
?>
+13 -28
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.2.2
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Monday 05th of March 2007 10:10:54 PM
| Release: e3790216629e5a2aaf37070b32237f06
| 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-05-25 10:15:22 -0400 (Thu, 25 May 2006) $
| > $Revision: 278 $
@@ -34,12 +24,12 @@
*/
/**
* API: Ìåíåäæåðà çàäà÷
* API: Tasks
*
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
* EXAMPLE USAGE
* <code>
* $api = new api_tasks();
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
* # Optional - if $ipsclass is not passed, it'll init
* $api->ipsclass =& $this->ipsclass;
* $api->api_init();
* $api->add_task( $path_to_xml_file );
@@ -67,9 +57,9 @@ if ( ! class_exists( 'api_core' ) )
}
/**
* API: Ìåíåäæåðà çàäà÷
* API: Tasks
*
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ äîáàâëåíèÿ çàäàíèé â ïëàíèðîâùèê ôîðóìà.
* This class deals with all available task insertion functions.
*
* @package InvisionPowerBoard
* @subpackage APIs
@@ -80,7 +70,7 @@ if ( ! class_exists( 'api_core' ) )
class api_tasks extends api_core
{
/**
* Îáúåêò ñóïåð-êëàññà IPS
* IPS Class Object
*
* @var object
*/
@@ -94,12 +84,12 @@ class api_tasks extends api_core
/*-------------------------------------------------------------------------*/
// Äîáàâëåíèå çàäà÷/Ñîçäàíèå íîâîãî ñïèñêà çàäà÷
// Add Tasks/Rebuild Tasks
/*-------------------------------------------------------------------------*/
/**
* Äîáàâëÿåò çàäà÷ó â ïëàíèðîâùèê IPB, èëè ñîçäàåò íîâûé ñïèñîê çàäà÷ èç XML
* Adds tasks to IPB, or Rebuilds tasks from XML file
*
* @param string Ïóòü ê xml-ôàéëó ñî ñïèñêîì çàäà÷
* @param string Path to xml file containing tasks
* @return void;
*/
function add_task( $xml_file_path='' )
@@ -143,8 +133,7 @@ class api_tasks extends api_core
require_once( KERNEL_PATH.'class_xml.php' );
$xml = new class_xml();
$xml->lite_parser = 1;
//-----------------------------------------
// Get XML file (TASKS)
//-----------------------------------------
@@ -162,12 +151,8 @@ class api_tasks extends api_core
//-----------------------------------------
// Ensure [0] is populated
//-----------------------------------------
$tmp = $xml->xml_array['export']['group']['row'];
unset($xml->xml_array['export']['group']['row']);
$xml->xml_array['export']['group']['row'][0] = $tmp;
$xml->xml_array['export']['group']['row'] = array( 0 => $xml->xml_array['export']['group']['row'] );
}
//-----------------------------------------
@@ -0,0 +1,170 @@
<?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: Topic Subscriptions
| > Module written by Brandon Farber
| > Date started: Tuesday 3rd April 2007 (10:25 AM)
|
+--------------------------------------------------------------------------
*/
/**
* API: Topic Subscriptions
*
* EXAMPLE USAGE
* <code>
$api = new api_topic_subscriptions();
$api->ipsclass =& $this->ipsclass;
// User id to pull tracked topics for
$api->config['userid'] = 1;
// How many to pull, can also set "offset" to define a start point
$api->config['limit'] = 10;
// Can be any column in ibf_topics (t) or ibf_tracker (tr)
$api->config['order_field'] = 't.last_post';
$topics = $api->return_topic_subscriptions();
// Loop on $topics and output the data, will contain joined ibf_topics and ibf_members data
* </code>
*
* @package InvisionPowerBoard
* @subpackage APIs
* @author Brandon Farber
* @copyright Invision Power Services, Inc.
* @version 2.2
*/
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: Topic Subscriptions
*
* This class deals with all available topic subscription (ibf_tracker) functions.
*
* @package InvisionPowerBoard
* @subpackage APIs
* @author Matt Mecham
* @version 2.2
* @since 2.3
*/
class api_topic_subscriptions extends api_core
{
/**
* IPS Class Object
*
* @var object
*/
var $ipsclass;
/**
* Config
*
* @var array
*/
var $config = array( 'offset' => 0,
'limit' => 10,
'userid' => 0,
'order_field' => 't.last_post',
'order_by' => 'DESC' );
/*-------------------------------------------------------------------------*/
// Returns an array of tracker and topic data
/*-------------------------------------------------------------------------*/
/**
* Returns an array of topic data
*
* @return array Array of topic data
*/
function return_topic_subscriptions()
{
//----------------------------------
// Init the config vars
//----------------------------------
$return_array = array();
if( !$this->config['userid'] OR intval($this->config['userid']) <= 0 )
{
return array();
}
if( !$this->config['order_field'] )
{
$this->config['order_field'] = 't.last_post';
}
if( !in_array( strtoupper($this->config['order_by']), array( 'DESC', 'ASC' ) ) )
{
$this->config['order_by'] = 'DESC';
}
//----------------------------------
// Get the appropriate data
//----------------------------------
$this->ipsclass->DB->build_query( array( 'select' => 'tr.*',
'from' => array( 'tracker' => 'tr' ),
'where' => 'tr.member_id=' . intval($this->config['userid']),
'order' => $this->config['order_field'] . ' ' . $this->config['order_by'],
'limit' => array( intval($this->config['offset']), intval($this->config['limit']) ),
'add_join' => array(
array( 'select' => 't.*',
'from' => array( 'topics' => 't' ),
'where' => 't.tid=tr.topic_id',
'type' => 'left'
),
array( 'select' => 'm.members_display_name',
'from' => array( 'members' => 'm' ),
'where' => 'm.id=t.last_poster_id',
'type' => 'left'
)
)
) );
$outer = $this->ipsclass->DB->exec_query();
if( !$this->ipsclass->DB->get_num_rows($outer) )
{
return array();
}
else
{
while( $r = $this->ipsclass->DB->fetch_row($outer) )
{
$return_array[] = $r;
}
}
return $return_array;
}
}
?>
+82 -62
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.2.2
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Monday 05th of March 2007 10:10:54 PM
| Release: e3790216629e5a2aaf37070b32237f06
| 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 $
@@ -34,22 +24,24 @@
*/
/**
* API: Ôîðóìîâ
* API: Forums
*
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
* EXAMPLE USAGE
* <code>
$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();
// Ïðîéòè ìàññèâ $topics è âûâåñòè äàííûå
// Loop on $topics and output the data
* </code>
*
* API âîçâðàùàåò èíôîðìàöèþ î ïðèêðåïëåííûõ ôàéëàõ â ìàññèâå
* attachment_data
* 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
(
@@ -68,14 +60,12 @@
)
)
* Ïåðåáèðàÿ êëþ÷è ìàññèâà attachment_data (åñëè îíè
* ñóùåñòâóþò - åñëè íåò, òî íåò è ïðèêðåïëåííûõ ôàéëîâ)
* ìîæíî îáðàáîòàòü êàæäûé ïðèêðåïëåííûé ôàéë.
* 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.
*
* Òèïû ïðèêðåïëåííûõ ôàéëîâ ( çíà÷åíèÿ types):
* thumb = ýñêèç,
* image = èçîáðàæåíèå,
* reg = ôàéë
* Attachment types - thumb = thumbnail, image = regular image
* reg = regular attachment
*
* @package InvisionPowerBoard
* @subpackage APIs
@@ -98,9 +88,9 @@ if ( ! class_exists( 'api_core' ) )
}
/**
* API: Ôîðóìîâ
* API: Languages
*
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ ðàáîòû ñ âûâîäîì òåì.
* This class deals with all available language functions.
*
* @package InvisionPowerBoard
* @subpackage APIs
@@ -111,37 +101,36 @@ if ( ! class_exists( 'api_core' ) )
class api_topic_view extends api_core
{
/**
* Îáúåêò ñóïåð-êëàññà IPS
* IPS Class Object
*
* @var object
*/
//var $ipsclass;
/**
* Êîíôèãóðàöèÿ âûâîäà ñïèñêà òåì
* Topic list config
*
* @var array
*/
var $topic_list_config = array( 'offset' => 0, // ñ êàêîé òåìû íà÷èíàòü âûâîä
'limit' => 5, // êîëè÷åñòâî âûâîäèìûõ òåì
'forums' => 1, // èç êàêèõ ôîðóìîâ áðàòü òåìû (ìîæåò áûòü ìàññèâîì)
'order_field' => 'last_post', // ïîëå ïî êîòîðîìó ñîðòèðîâàòü òåìû
'order_by' => 'DESC' ); // ïîðÿäîê ñîðòèðîâêè
var $topic_list_config = array( 'offset' => 0,
'limit' => 5,
'forums' => '*',
'order_field' => 'last_post',
'order_by' => 'DESC' );
var $attach_pids = array();
/*-------------------------------------------------------------------------*/
// Ïîëó÷åíèå ìàññèâà äàííûõ òåì
// Returns an array of topic data
/*-------------------------------------------------------------------------*/
/**
* Âîçâðàùàåò ìàññèâ ñ äàííûìè âñåõ òåì
*
* ÂÍÈÌÀÍÈÅ: ìåòîä âîçâðàùàåò ÂÑÅ òåìû, ïðàâà ïîëüçîâàòåëÿ íå ó÷èòûâàþòñÿ, ò.å.
* äîñòóïíû âñå ôîðóìû!
* Returns an array of topic data
* NOTE: Returns ALL topics regardless of permission as
* if viewed from the ACP.
*
* @return array Ìàññèâ ñ äàííûìè òåì
* @return array Array of topic data
*/
function return_topic_list_data()
function return_topic_list_data( $view_as_guest=0 )
{
//-----------------------------------------
// INIT
@@ -149,17 +138,7 @@ class api_topic_view extends api_core
$topics = array();
$this->ipsclass->init_load_cache( array( 'bbcode','emoticons','attachtypes' ) );
//-----------------------------------------
// Load parser
//-----------------------------------------
require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
$parser = new parse_bbcode();
$parser->ipsclass =& $this->ipsclass;
$parser->allow_update_caches = 0;
$parser->bypass_badwords = 0;
$this->ipsclass->init_load_cache( array( 'attachtypes' ) );
//-----------------------------------------
// Set up
@@ -169,6 +148,57 @@ class api_topic_view extends api_core
$this->topic_list_config['order_field'] = ( $this->topic_list_config['order_field'] == 'lastpost' ) ? 'last_post' : $this->topic_list_config['order_field'];
$this->topic_list_config['forums'] = ( is_array( $this->topic_list_config['forums'] ) ) ? implode( ",", $this->topic_list_config['forums'] ) : $this->topic_list_config['forums'];
//-----------------------------------------
// Fix up allowed forums
//-----------------------------------------
if ( $this->topic_list_config['forums'] )
{
# Init forums...
if ( $view_as_guest )
{
$this->ipsclass->perm_id_array = explode( ',', $this->ipsclass->create_perms_from_group( $this->ipsclass->vars['guest_group'] ) );
$this->ipsclass->forums->strip_invisible = 1;
}
$this->ipsclass->forums->forums_init();
# Reset topics...
if ( $this->topic_list_config['forums'] == '*' )
{
$_tmp_array = array();
$this->topic_list_config['forums'] = '';
foreach( $this->ipsclass->forums->forum_by_id as $id => $data )
{
$_tmp_forums[] = $id;
}
}
else
{
$_tmp_forums = explode( ',', $this->topic_list_config['forums'] );
$_tmp_array = array();
$this->topic_list_config['forums'] = '';
}
foreach( $_tmp_forums as $_id )
{
if ( $view_as_guest )
{
if ( ! $this->ipsclass->forums->forums_quick_check_access( $_id ) )
{
$_tmp_array[] = $_id;
}
}
else
{
$_tmp_array[] = $_id;
}
}
$this->topic_list_config['forums'] = implode( ',', $_tmp_array );
}
//-----------------------------------------
// Get from the DB
//-----------------------------------------
@@ -197,16 +227,6 @@ class api_topic_view extends api_core
while( $row = $this->ipsclass->DB->fetch_row() )
{
//-----------------------------------------
// Format posts
//-----------------------------------------
$parser->parse_html = ( $row['use_html'] AND $row['post_htmlstate'] ) ? 1 : 0;
$parser->parse_wordwrap = $this->ipsclass->vars['post_wordwrap'];
$parser->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
$row['post'] = $parser->pre_display_parse( $row['post'] );
if( $row['topic_hasattach'] )
{
$this->attach_pids[] = $row['pid'];
@@ -234,7 +254,7 @@ class api_topic_view extends api_core
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
'from' => 'attachments',
'where' => "attach_pid IN (".implode(",", $this->attach_pids).")"
'where' => "attach_rel_module='post' AND attach_rel_id IN (".implode(",", $this->attach_pids).")"
) );
$this->ipsclass->DB->simple_exec();
+121 -108
View File
@@ -2,27 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.2.2
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Monday 05th of March 2007 10:10:54 PM
| Release: e3790216629e5a2aaf37070b32237f06
| 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-10-19 17:06:53 -0500 (Thu, 19 Oct 2006) $
| > $Revision: 661 $
| > $Date: 2007-12-17 18:07:20 -0500 (Mon, 17 Dec 2007) $
| > $Revision: 1149 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
@@ -34,30 +24,26 @@
*/
/**
* API: Ñîçäàíèå ñîîáùåíèé è òåì
* API: Topics & Posts
*
* ÂÍÈÌÀÍÈÅ: Ìåòîäû äàííîãî API ÍÅ ÏÐÎÂÅÐßÞÒ ïðàâà ïîëüçîâàòåëåé
* Ïî ýòîìó ïðè íåïðàâèëüíîì èñïîëüçîâàíèè ìåòîäîâ âîçìîæíû îòâåòû
* ïîëüçîâàòåëÿ â çàêðûòûå òåìû, à òàê æå ñîçäàíèå íîâûõ òåì è
* ñîîáùåíèé â ôîðóìàõ, ê êîòîðûì ïîëüçîâàòåëü íåò èìååò äîñòóïà.
* Äëÿ èçáåæàíèÿ òàêèõ ýôôåêòîâ ÎÁßÇÀÒÅËÜÍÎ ïðîâåðÿéòå ïðàâà
* ïîëüçîâàòåëÿ ïðåæäå ÷åì âûçûâàòü ìåòîä.
*
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
* IMPORTANT: This API DOESN'T check permissions, etc
* So, it's entirely possible to add replies to closed topics
* and to post new topics where the user doesn't normally have
* permission.
* EXAMPLE USAGE
* <code>
* $api = new api_topics_and_posts();
* $api->ipsclass =& $this->ipsclass;
* // ÄÎÁÀÂËÅÍÈÅ ÎÒÂÅÒÀ
* // ADD POST REPLY
* $api->set_author_by_name('matt');
* $api->set_post_content("<b>Hello World!</b> :D");
* $api->set_topic_id( 100 );
* # Ïî-óìîë÷àíèþ ôëàã show_signature âñåãäà 1, çäåñü äîáàâëåíî äëÿ ïîëíîòû ôîðìû
* # Default for show_signature is 1, added here for completeness
* $api->post_settings['show_signature'] = 1;
* # Îïöèîíàëüíî âû ìîæåòå îòêëþ÷èòü ïåðåñ÷åò òåì, ñîîáùåíèé è ñòàòèñòèêè
* # äîñòàòî÷íî ðàññêîìåíòèðîâàòü ñòðî÷êó íèæå
* # Optionally turn off rebuild to not rebuild topic, forum and stats
* # $api->delay_rebuild = 1;
* $api->create_new_reply();
* // ÑÎÇÄÀÍÈÅ ÍÎÂÎÉ ÒÅÌÛ
* // ADD NEW TOPIC
* $api->set_author_by_name('matt');
* $api->set_post_content("<b>Hello World!</b> :D");
* $api->set_forum_id( 10 );
@@ -88,9 +74,9 @@ if ( ! class_exists( 'api_core' ) )
}
/**
* API: Ñîçäàíèå ñîîáùåíèé è òåì
* API: Topics & Posts
*
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ ñîçäàíèÿ òåì è ñîîáùåíèé.
* This class deals with all showing, creating and editing topics and posts
*
* @package InvisionPowerBoard
* @subpackage APIs
@@ -101,101 +87,101 @@ if ( ! class_exists( 'api_core' ) )
class api_topics_and_posts extends api_core
{
/**
* Èíôîðìàöèÿ îá àâòîðå äëÿ ÁÄ
* Author DB row
*
* @var array
*/
var $author = array();
/**
* Ñîäåðæèìîå ñîîáùåíèÿ
* Post content
*
* @var string
*/
var $post_content = "";
/**
* ID òåìû
* Topic ID
*
* @var integer
*/
var $topic_id = "";
/**
* ID ôîðóìà
* Set forum ID
*
* @var integer
*/
var $forum_id = "";
/**
* Èíôîðìàöèÿ î òåìå äëÿ ÁÄ
* Topic DB row
*
* @var array
*/
var $topic = array();
/**
* Èíôîðìàöèÿ î ôîðóìå
* Forum DB row
*
* @var array
*/
var $forum = array();
/**
* Îáúåêò ðåäàêòîðà
* Editor class
*
* @var object
*/
var $editor;
/**
* Îáúåêò îáðàáîò÷èêà îòïðàâêè ñîîáùåíèé/òåì
* Post class
*
* @var object
*/
var $post;
/**
* Îáúåêò ìåéëåðà ñèñòåìû
* Email class
*
* @var object
*/
var $email;
/**
* Îáúåêò ïàðñåðà ñîîáùåíèé
* Parser class
*
* @var object
*/
var $parser;
/**
* Îáúåêò ìîäåðàòîðñêèõ ôóíêöèé
* Func Mod
*
* @var object
*/
var $func_mod;
/**
* Ôëàã çàãðóæåííîñòè êëàññîâ
* Flag classes loaded?
*
* @var integer boolean
*/
var $classes_loaded = 0;
/**
* Ôëàã îòëîæåííîãî îáíîâëåíèÿ êåøà
* Delay rebuild flag
*
* Åñëè ôëàã óñòàíîâëåí â 1, âàì áóäåò íåîáõîäèìî
* ñàìèì îáíîâèòü âñå ñ÷åò÷èêè òåì, ôîðóìîâ è ñòàòèñòèêè.
* If set to 1, you will need to manually
* rebuild topic info and forum info.
*
* @var integer boolean
*/
var $delay_rebuild = 0;
/**
* Íàñòðîéêè ñîîáùåíèÿ
* Post settings
*
* @var array show_signature, show_emoticons, post_icon_id, is_invisible, post_date, ip_address, parse_html
*/
@@ -209,7 +195,7 @@ class api_topics_and_posts extends api_core
'parse_html' => 0 );
/**
* Íàñòðîéêè òåìû
* Topic settings
*
* @var array topic_date, post_icon_id
*/
@@ -217,45 +203,45 @@ class api_topics_and_posts extends api_core
'post_icon_id' => 0 );
/**
* Íàçâàíèå òåìû
* Topic title
*
* @var string
*/
var $topic_title;
/**
* Îïèñàíèå òåìû
* Topic description
*
* @var string
*/
var $topic_desc;
/**
* Ñòàòóñ òåìû (îòêðûòà/çàêðûòà)
* Topic state
*
* @var string (open or closed)
*/
var $topic_state = 'open';
/**
* Âàæíîñòü òåìû (ïðèêðåïëåíà/íåò)
* Topic pinned
*
* @var integer
*/
var $topic_pinned = 0;
/**
* Ñêðûòîñòü òåìû (ñêðûòà/âèäèìà)
* Topic invisible
*
* @var integer
*/
var $topic_invisible = 0;
/*-------------------------------------------------------------------------*/
// Ñîçäàíèå íîâîé òåìû
// Create new topic
/*-------------------------------------------------------------------------*/
/**
* Ñîõðàíÿåò íîâóþ òåìó è ñîîáùåíèå
* Saves the post
*
* @return void
*/
@@ -335,10 +321,10 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Ñîçäàíèå íîâîãî îòâåòà â òåìó
// Create new topic
/*-------------------------------------------------------------------------*/
/**
* Ñîçäàåò íîâóþ òåìó
* Create new topic
*
* @return void
*/
@@ -431,12 +417,12 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà íàçâàíèÿ òåìû
// Set topic: title
/*-------------------------------------------------------------------------*/
/**
* Óñòàíàâëèâàåò íàçâàíèå äëÿ ñîçäàâàåìîé òåìû
* Set topic title
*
* @param string Íàçâàíèå òåìû
* @param string Incoming
* @return void
*/
function set_topic_title( $data )
@@ -445,12 +431,12 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà îïèñàíèÿ òåìû
// Set topic: desc
/*-------------------------------------------------------------------------*/
/**
* Óñòàíàâëèâàåò îïèñàíèå äëÿ ñîçäàâàåìîé òåìû
* Set topic description
*
* @param string Îïèñàíèå òåìû
* @param string Incoming
* @return void
*/
function set_topic_description( $data )
@@ -459,12 +445,12 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà ñòàòóñà òåìû
// Set topic: state
/*-------------------------------------------------------------------------*/
/**
* Óñòàíàâëèâàåò ñòàòóñà äëÿ ñîçäàâàåìîé òåìû
* Set topic state
*
* @param string Ñòàòóñ (open/closed)
* @param string Incoming
* @return void
*/
function set_topic_state( $data )
@@ -473,12 +459,12 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà âàæíîñòè òåìû
// Set topic: pinned
/*-------------------------------------------------------------------------*/
/**
* Óñòàíàâëèâàåò âàæíîñòü äëÿ ñîçäàâàåìîé òåìû
* Set topic pinned
*
* @param string Ïðèêðåïëåíà / íå ïðèêðåïëåíà (1 / 0)
* @param string Incoming
* @return void
*/
function set_topic_pinned( $data )
@@ -487,12 +473,12 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà âèäèìîñòè òåìû
// Set topic: invisible
/*-------------------------------------------------------------------------*/
/**
* Óñòàíàâëèâàåò âèäèìîñòü äëÿ ñîçäàâàåìîé òåìû
* Set topic pinned
*
* @param string Òåìà îïóáëèêîâàíà / íå îïóáëèêîâàíà (0 / 1)
* @param string Incoming
* @return void
*/
function set_topic_invisible( $data )
@@ -501,13 +487,13 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà ñîäåðæèìîãî ñîîáùåíèÿ
// Set post content
/*-------------------------------------------------------------------------*/
/**
* Óñòàíàâëèâàåò ñîäåðæèìîå ñîîáùåíèÿ äëÿ ñîçäàâàåìîé òåìû/ñîîáùåíèÿ
* Set the post content
*
* @param string ñîäåðæèìîå ñîîáùåíèÿ
* @return boolean èíèöèàëèçàöèÿ $this->post_content
* @param string post content
* @return boolean populates $this->post_content
*/
function set_post_content( $post )
{
@@ -532,20 +518,49 @@ class api_topics_and_posts extends api_core
$this->parser->parse_html = $this->post_settings['parse_html'];
$this->parser->parse_bbcode = 1;
$this->post_content = $this->parser->pre_db_parse( $this->editor->_rte_html_to_bbcode( $post ) );
$_POST['my_dummy_post'] =& $post;
$this->post_content = $this->parser->pre_display_parse( $this->parser->pre_db_parse( $this->editor->process_after_form( 'my_dummy_post' ) ) );
unset($_POST['my_dummy_post']);
return TRUE;
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà àâòîðà ïî èìåíè ïîëüçîâàòåëÿ
// Set author by email
/*-------------------------------------------------------------------------*/
/**
* Ïîëó÷àåò èíôîðìàöèþ î ïîëüçîâàòåëå è óñòàíàâëèâàåò àâòîðà
* òåìû/ñîîáùåíèÿ ïî èìåíè ïîëüçîâàòåëÿ
* Get a member from the DB by email address
*
* @param string èìÿ ïîëüçîâàòåëÿ
* @return boolean èíèöèàëèçàöèÿ $this->author
* @param string email address
* @return boolean populates $this->author
*/
function set_author_by_email( $email )
{
$this->author = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
'from' => 'members',
'where' => "email = '".$this->ipsclass->DB->add_slashes(strtolower($email))."'",
'limit' => array( 0, 1 ) ) );
if ( ! $this->author['id'] )
{
$this->api_error[] = 'no_user_found';
$this->author = array();
return FALSE;
}
return TRUE;
}
/*-------------------------------------------------------------------------*/
// Set author by user_name
/*-------------------------------------------------------------------------*/
/**
* Get a member from the DB by username
*
* @param string user name
* @return boolean populates $this->author
*/
function set_author_by_name( $user_name )
{
@@ -565,14 +580,13 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà àâòîðà ïî id ïîëüçîâàòåëÿ
// Set author by id
/*-------------------------------------------------------------------------*/
/**
* Ïîëó÷àåò èíôîðìàöèþ î ïîëüçîâàòåëå è óñòàíàâëèâàåò àâòîðà
* òåìû/ñîîáùåíèÿ ïî ID ïîëüçîâàòåëÿ
/**
* Get a member from the DB by ID
*
* @param integer ID ïîëüçîâàòåëÿ
* @return boolean èíèöèàëèçàöèÿ $this->author
* @param integer User ID
* @return boolean populates $this->author
*/
function set_author_by_id( $id )
{
@@ -592,14 +606,13 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà àâòîðà ïî îòîáðàæàåìîìó èìåíè ïîëüçîâàòåëÿ
// Set author by display_name
/*-------------------------------------------------------------------------*/
/**
* Ïîëó÷àåò èíôîðìàöèþ î ïîëüçîâàòåëå è óñòàíàâëèâàåò àâòîðà
* òåìû/ñîîáùåíèÿ ïî îòîáðàæàåìîìó èìåíè ïîëüçîâàòåëÿ
* Get a member from the DB by display name
*
* @param string îòîáðàæàåìîå èìÿ ïîëüçîâàòåëÿ
* @return boolean èíèöèàëèçàöèÿ $this->author
* @param string member display name
* @return boolean populates $this->author
*/
function set_author_by_display_name( $display_name )
{
@@ -618,14 +631,13 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà òåìû ïî id
// Set topic by id
/*-------------------------------------------------------------------------*/
/**
* Ïîëó÷àåò èíôîðìàöèþ î òåìå èç áàçû è óñòàíàâëèâàåò
* òåêóùóþ òåìó ïî ID òåìû
* Get a topic from the DB by ID and set the current topic id
*
* @param integer ID òåìû
* @return boolean èíèöèàëèçàöèÿ $this->author
* @param integer Topic
* @return boolean populates $this->author
*/
function set_topic_id( $id )
{
@@ -657,14 +669,13 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Óñòàíîâêà ôîðóìà ïî id
// Set author by id
/*-------------------------------------------------------------------------*/
/**
* Ïîëó÷àåò èíôîðìàöèþ î ôîðóìå è óñòàíàâëèâàåò
* òåêóùèé ôîðóì ïî ID ôîðóìà
* Get DB info and set forum ID
*
* @param integer ID ôîðóìà
* @return boolean èíèöèàëèçàöèÿ $this->author
* @param integer Topic
* @return boolean populates $this->author
*/
function set_forum_id( $id )
{
@@ -699,12 +710,11 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Îáíîâëåíèå ñ÷åò÷èêîâ ôîðóìà
// Rebuild forum stats
/*-------------------------------------------------------------------------*/
/**
* Îáíîâëÿåò êåøè ñ÷åò÷èêîâ òåì è ñîîáùåíèé ôîðóìà ñ óêàçàííûì ID
* Rebuilds the forum stats
*
* @param integer ID ôîðóìà
* @return void
*/
function tap_rebuild_forum( $forum_id )
@@ -723,10 +733,10 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Îáíîâëåíèå ñòàòèñòèêè ôîðóìà
// Rebuild stats
/*-------------------------------------------------------------------------*/
/**
* Îáíîâëÿåò êåø ãëîáàëüíîé ñòàòèñòèêè ôîðóìà
* Rebuilds the global stats
*
* @return void
*/
@@ -746,10 +756,10 @@ class api_topics_and_posts extends api_core
}
/*-------------------------------------------------------------------------*/
// Ïîäêëþ÷åíèå êëàññîâ ñèñòåìû
// Add language strings to IPB language system
/*-------------------------------------------------------------------------*/
/**
* Ïîäêëþ÷àåò íåîáõîäèìûå êëàññû äëÿ ðàáîòû ñèñòåìû îòïðàâêè ñîîáùåíèé/òåì
* Loads required classes...
*
* @return void;
*/
@@ -792,6 +802,7 @@ class api_topics_and_posts extends api_core
$this->post = new class_post();
$this->post->ipsclass =& $this->ipsclass;
$this->post->email =& $this->email;
$this->post->forum =& $this->forum;
//^^ Required for forum tracker
}
@@ -801,6 +812,8 @@ class api_topics_and_posts extends api_core
if ( ! is_object( $this->parser ) )
{
$this->ipsclass->init_load_cache( array( 'emoticons', 'bbcode' ) );
require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
$this->parser = new parse_bbcode();
$this->parser->ipsclass =& $this->ipsclass;
+1 -10
View File
@@ -1,10 +1 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1251" />
<meta name="author" content="Êîìïàíèÿ IBResource è Invision Power Services Inc.">
<title>Îøèáêà ðóññêîé âåðñèè Invision Power Board</title>
</head><body>
<h1>Îøèáêà <a href="http://www.ibresource.ru/">ðóññêîé âåðñèè Invision Power Board</a></h1>
<font size="4">Âû ïîïàëè íà íåñóùåñòâóþùóþ ñòðàíèöó!<br>Ïîæàëóéñòà íàæìèòå íà êíîïî÷êó &laquo;<b>Íàçàä</b>&raquo; â&nbsp;âàøåì áðàóçåðå äëÿ âîçâðàùåíèÿ íà ïðåäûäóùóþ ñòðàíèöó.</font>
</body>
</html>
<html>␍<head><title>Invision Power Board - Bulletin Board System</title></head>␍<body>␍<h1>403: Invision Power Board -> Forbidden</h1>␍<hr>␍You have reached this Page in error, please use␍your back button to return to Invision Board.␍<hr>␍<a href="http://anonym.to/http://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>