Version 2.2.2
This commit is contained in:
1 parent
22f1b963ee
commit
a3bb603c96
858 files changed
+479463
-188140
No files matched your search
@@ -2,18 +2,28 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| 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
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
| 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 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Components
|
||||
@@ -24,25 +34,25 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Components
|
||||
* API: Êîìïîíåíòîâ ôîðóìà
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
|
||||
* <code>
|
||||
* //-- UPDATE EXISTING ROW --//
|
||||
* //-- ÎÁÍÎÂËÅÍÈÅ ÑÓÙÅÑÒÂÓÞÙÅÃÎ ÊÎÌÏÎÍÅÍÒÀ --//
|
||||
* $api = new api_components();
|
||||
* # Optional - if $ipsclass is not passed, it'll init
|
||||
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
|
||||
* $api->ipsclass =& $this->ipsclass;
|
||||
* $api->api_init();
|
||||
* $update = array (
|
||||
* 'com_version' => '1.3',
|
||||
* 'com_menu_data' => array( 0 => array(
|
||||
* 'menu_text' => 'Link text',
|
||||
* 'menu_text' => 'Íàçâàíèå ïóíêòà ìåíþ',
|
||||
* 'menu_url' => 'code=showme',
|
||||
* 'menu_redirect' => 0,
|
||||
* 'menu_permbit' => 'keyhere',
|
||||
* 'menu_permlang' => 'Allow CREATE Something' ),
|
||||
* 'menu_permlang' => 'Ïîçâîëÿåò ñîçäàòü ÷òî-òî' ),
|
||||
* 1 => array(
|
||||
* 'menu_text' => 'Link text 2',
|
||||
* 'menu_text' => 'Íàçâàíèå ïóíêòà ìåíþ 2',
|
||||
* 'menu_url' => 'section=tools&act=op&code=showme2',
|
||||
* 'menu_redirect' => 1,
|
||||
* 'menu_permbit' => 'add',
|
||||
@@ -50,23 +60,23 @@
|
||||
* ) );
|
||||
*
|
||||
* $api->acp_component_update( 'blog', $update );
|
||||
* //-- ENABLE A COMPONENT --//
|
||||
* //-- ÂÊËÞ×ÅÍÈÅ ÊÎÌÏÎÍÅÍÒÀ --//
|
||||
* $api->acp_component_enable( 'blog' );
|
||||
* </code>
|
||||
*
|
||||
* COMPONENT FIELDS
|
||||
* ÏÎËß ÊÎÌÏÎÍÅÍÒ (ÑÒÐÓÊÒÓÐÀ ÊÎÌÏÎÍÅÍÒ)
|
||||
* <code>
|
||||
* '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
|
||||
* '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' = Íàçâàíèå êîìïîíåíòà â âåðõíåì ìåíþ ôîðóìà
|
||||
* </code>
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
@@ -95,9 +105,9 @@ if ( ! defined('IPS_API_CORE_LOADED') )
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Components
|
||||
* API: Êîìïîíåíòîâ ôîðóìà
|
||||
*
|
||||
* This class deals with all available components functions.
|
||||
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ ðàáîòû ñ êîìïîíåíòàìè ôîðóìà.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
@@ -108,27 +118,27 @@ if ( ! defined('IPS_API_CORE_LOADED') )
|
||||
class api_components extends api_core
|
||||
{
|
||||
/**
|
||||
* Loaded component
|
||||
* Èíôîðìàöèÿ î êîìïîíåíòå
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $component;
|
||||
|
||||
/**
|
||||
* XML Parser Object
|
||||
* Îáúåêò XML ïàðñåðà
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
var $xml;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Get component by key
|
||||
// Ïîëó÷åíèå èíôîðìàöèè î êîìïîíåíòå ïî åãî êëþ÷ó (èìåíè ñåêöèè êîìïîíåíòà)
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Updates a component
|
||||
* Ïîëó÷àåò âñþ èíôîðìàöèþ î êîìïîíåíòå
|
||||
*
|
||||
* @param string Component key (eg: blog)
|
||||
* @return void Populates $this->component
|
||||
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: blog)
|
||||
* @return void Çàïîëíÿåò $this->component
|
||||
*/
|
||||
function get_component_by_key( $key )
|
||||
{
|
||||
@@ -138,10 +148,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']
|
||||
@@ -150,8 +160,8 @@ class api_components extends api_core
|
||||
* $menu_data [ $item_id ]['menu_permlang']
|
||||
* </code>
|
||||
*
|
||||
* @param array multi-dimenisonal array
|
||||
* @return void;
|
||||
* @param array ìíîãîóðîâíåâûé ìàññèâ
|
||||
* @return string ñåðèàëèçîâàííûé ìàññèâ
|
||||
*/
|
||||
function acp_component_create_menu_data( $menu_data )
|
||||
{
|
||||
@@ -163,12 +173,12 @@ class api_components extends api_core
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Import XML File
|
||||
// Èìïîðòèðîâàíèå êîìïîíåíò èç XML ôàéëà
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Updates/inserts a component from xml file
|
||||
* Îáíîâëÿåò/äîáàâëÿåò êîìïîíåíòû èç xml ôàéëà
|
||||
*
|
||||
* @param string Path to XML File
|
||||
* @param string Ïóòü ê XML ôàéëó
|
||||
* @return array;
|
||||
*/
|
||||
function acp_component_import( $xml_file_path )
|
||||
@@ -208,6 +218,7 @@ 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
|
||||
@@ -220,7 +231,7 @@ class api_components extends api_core
|
||||
//-----------------------------------------
|
||||
|
||||
$fields = array( 'com_title' , 'com_description', 'com_author' , 'com_url', 'com_version', 'com_menu_data',
|
||||
'com_enabled' , 'com_safemode' , 'com_section', 'com_filename' );
|
||||
'com_enabled' , 'com_safemode' , 'com_section', 'com_filename', 'com_url_title', 'com_url_uri' );
|
||||
|
||||
if ( ! is_array( $this->xml->xml_array['componentexport']['componentgroup']['component'][0] ) )
|
||||
{
|
||||
@@ -276,13 +287,14 @@ class api_components extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Update component
|
||||
// Äîáàâëåíèå êîìïîíåíòà
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Updates a component
|
||||
* Äîáàâëÿåò íîâûé êîìïîíåíò â ñèñòåìó
|
||||
*
|
||||
* @param string Component key (eg: blog)
|
||||
* @param array Component fields ( must match class fields, see class docs )
|
||||
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: áëîã)
|
||||
* @param array Ìàññèâ îáíîâëÿåìûõ ïîëåé ( äîëæåí ñîâïàäàòü ñî ñòðóêòóðîé
|
||||
* êîìïîíåíò, ñì. â êîììåíòàðèÿõ ê ýòîìó êëàññó )
|
||||
* @return void;
|
||||
*/
|
||||
function acp_component_insert( $key, $fields )
|
||||
@@ -374,13 +386,14 @@ class api_components extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Update component
|
||||
// Îáíîâëåíèå êîìïîíåíòà
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Updates a component
|
||||
* Îáíîâëÿåò ñëæåáíóþ èíôîðìàöèþ êîìïîíåíòà
|
||||
*
|
||||
* @param string Component key (eg: blog)
|
||||
* @param array Component fields ( must match class fields, see class docs )
|
||||
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: áëîã)
|
||||
* @param array Ìàññèâ îáíîâëÿåìûõ ïîëåé ( äîëæåí ñîâïàäàòü ñî ñòðóêòóðîé
|
||||
* êîìïîíåíò, ñì. â êîììåíòàðèÿõ ê ýòîìó êëàññó )
|
||||
* @return void;
|
||||
*/
|
||||
function acp_component_update( $key, $fields )
|
||||
@@ -479,12 +492,13 @@ class api_components extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Remove component
|
||||
// Óäàëåíèå êîìïîíåíòà
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Remove a component [ no confirmation screens! ]
|
||||
* Óäàëÿåò êîìïîíåíò èç ñèñòåìó [ Âíèìàíèå, ìåòîä íå ïåðäîñòàâëÿåò
|
||||
* íè êàêèõ ïîäòâåðæäåíèé óäàëåíèÿ ! ]
|
||||
*
|
||||
* @param string Component key (eg: blog)
|
||||
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: blog)
|
||||
* @return void
|
||||
*/
|
||||
function acp_component_remove( $key )
|
||||
@@ -494,12 +508,13 @@ class api_components extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Enable component
|
||||
// Âêëþ÷åíèå êîìïîíåíòà
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Enable a component
|
||||
* Àêòèâèðóåò êîìïîíåíò - îí ñòàíîâèòñÿ äîñòóïíûì â ïîëüçîâàòåëüñêîé ÷àñòè
|
||||
* ôîðóìà
|
||||
*
|
||||
* @param string Component key (eg: blog)
|
||||
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: blog)
|
||||
* @return void
|
||||
*/
|
||||
function acp_component_enable( $key )
|
||||
@@ -509,12 +524,12 @@ class api_components extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Disable component
|
||||
// Îòêëþ÷åíèå êîìïîíåíòà
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Enable a component
|
||||
* Äåàêòèâèðóåò êîìïîíåíò
|
||||
*
|
||||
* @param string Component key (eg: blog)
|
||||
* @param string Êëþ÷ êîìïîíåíòà (íàïð-ð: blog)
|
||||
* @return void
|
||||
*/
|
||||
function acp_component_disable( $key )
|
||||
@@ -524,10 +539,10 @@ class api_components extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Components Rebuild Cache
|
||||
// Ïåðåñòðîéêà êåøà êîìïîíåíòîâ
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Rebuild cache
|
||||
* Ñîçäàåò íîâûé êåø êîìïîíåíòîâ
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -2,16 +2,26 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| 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
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| 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 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
@@ -24,17 +34,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: CORE
|
||||
* API: ßÄÐÎ
|
||||
*
|
||||
* 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
|
||||
* Äàííûé êëàññ ñîäåðæèò âñå áàçîâûå ôóíêöèè, à òàêæå âñå ôóíêöèè ïî ðàáîòå
|
||||
* ñ ÿçûêàìè.
|
||||
* Åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò êëàññà, òî îáúåêò ipsclass
|
||||
* èíèöèàëèçèðóåòñÿ àâòîìàòè÷åñêèþ, çàãðóæàþòñÿ âñå íåîáõîäèìûå áàçîâûå êëàññû
|
||||
* è èíèöèàëèçèðóþòñÿ èõ îáúåêòû (DB, converge, forums, display, session).
|
||||
* Ñîçäàåòñÿ íîâîå ïîäêëþ÷åíèå ê ÁÄ, çàãðóæàþòñÿ âñå íåîáõîäèìûå êåøè.
|
||||
* Âû ìîæåòå óïðàâëÿòü ïîäêëþ÷åíèåì êëàññîâ ÷åðåç ìàññèâ
|
||||
* $this->load_classes[-class-] = 1;
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
@@ -44,9 +53,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: CORE
|
||||
* API: ßÄÐÎ
|
||||
*
|
||||
* This class deals with all core functions.
|
||||
* Êëàññ ïðåäîñòàâëÿåò âñå áàçîâûå ìåòîäû API.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
@@ -57,7 +66,7 @@
|
||||
class api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
* Îáúåêò ñóïåð-êëàññà IPS
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
@@ -71,30 +80,30 @@ class api_core
|
||||
var $init_run;
|
||||
|
||||
/**
|
||||
* API Error string
|
||||
* Ìàññèâ îøèáîê API
|
||||
*
|
||||
* @var array Errors
|
||||
*/
|
||||
var $api_error = array();
|
||||
|
||||
/**
|
||||
* API Load full?
|
||||
* Ôëàã ïîëíîé çàãðóçêè API
|
||||
*
|
||||
* @var integer boolean
|
||||
*/
|
||||
var $full_load = 1;
|
||||
|
||||
/**
|
||||
* API Path to IPB root (where init.php/index.php is)
|
||||
* Êîðíåâîé ïóòü äëÿ API (ãäå íàõîäÿòñÿ ôàéëû init.php/index.php)
|
||||
*
|
||||
* @var string Path to IPB root folder
|
||||
* @var string Ïóòü ê êîðíåâîé äèðåêòîðèè IPB
|
||||
*/
|
||||
var $path_to_ipb = '../../';
|
||||
|
||||
/**
|
||||
* API Load classes
|
||||
* Êëàññû äëÿ çàãðóçêè API
|
||||
*
|
||||
* @var array Classes to load default: [print,forums,converge,session]
|
||||
* @var array Êëàññû çàãðóæàåìûå ïî óìîë÷àíèþ: [print,forums,converge,session]
|
||||
*/
|
||||
var $load_classes = array( 'print' => 1,
|
||||
'forums' => 1,
|
||||
@@ -102,11 +111,11 @@ class api_core
|
||||
'session' => 1 );
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// API init
|
||||
// Èíèöèàëèçàöèÿ API
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Determines if we have required ipsclass vars
|
||||
* on hand
|
||||
* Ïðîâåðêà íàëè÷èÿ íåîáõîäèìîãî îáúåêòà ipsclass è íåîáõîäèìîñòü ïîäêëþ÷åíèÿ
|
||||
* íåîáõîäèìûõ êëàññîâ
|
||||
*
|
||||
* @return void;
|
||||
*/
|
||||
|
||||
@@ -2,14 +2,24 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| 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: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
|
||||
| > $Revision: 23 $
|
||||
@@ -24,11 +34,15 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Forums
|
||||
* API: Ôîðóìîâ
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
|
||||
* <code>
|
||||
* To follow
|
||||
* $api = new api_forums();
|
||||
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
|
||||
* $api->ipsclass =& $this->ipsclass;
|
||||
* $api->api_init();
|
||||
* $jump_list = $api->return_forum_jump_option_list( array(1,3,5) );
|
||||
* </code>
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
@@ -52,9 +66,9 @@ if ( ! class_exists( 'api_core' ) )
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Languages
|
||||
* API: Ôîðóìîâ
|
||||
*
|
||||
* This class deals with all available language functions.
|
||||
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ ïîëó÷åíèÿ ñïèñêà ôîðóìîâ.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
@@ -73,15 +87,14 @@ class api_forums extends api_core
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Returns a forum jump option list
|
||||
// Ïîëó÷åíèå ñïèñêà ôîðóìîâ â âèäå ñïèñêà <option></option>
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Returns a forum jump list WITHOUT the SELECT tag
|
||||
* NOTE: Returns ALL forums regardless of permission as
|
||||
* if viewed from the ACP.
|
||||
* Âîçâðàùàåò ñïèñîê âñåõ ôîðóìîâ ÁÅÇ òåãà SELECT
|
||||
* Âíèìàíèå: ìåòîä âîçâðàùàåò ÂÑÅ ôîðóìû áåç ó÷åòà ïðàâ äîñòóïà.
|
||||
*
|
||||
* @param array Array of selected IDs
|
||||
* @return string HTML <option> list of forums;
|
||||
* @param array Ìàññèâ ID âûáðàííûõ ôîðóìîâ
|
||||
* @return string HTML <option> ñïèñîê ôîðóìîâ;
|
||||
*/
|
||||
function return_forum_jump_option_list( $selected=array() )
|
||||
{
|
||||
|
||||
@@ -2,18 +2,28 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| 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
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
| 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 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Languages
|
||||
@@ -24,12 +34,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Languages
|
||||
* API: ßçûêîâ
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
|
||||
* <code>
|
||||
* $api = new api_language();
|
||||
* # Optional - if $ipsclass is not passed, it'll init
|
||||
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
|
||||
* $api->ipsclass =& $this->ipsclass;
|
||||
* $api->api_init();
|
||||
* $api->lang_add_strings( array('lang_key' => "Language value" ), 'lang_subscriptions' );
|
||||
@@ -56,9 +66,9 @@ if ( ! class_exists( 'api_core' ) )
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Languages
|
||||
* API: ßçûêîâ
|
||||
*
|
||||
* This class deals with all available language functions.
|
||||
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ äîáàâëåíèÿ ÿçûêîâûõ êîíñòðóêöèé.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
@@ -77,14 +87,14 @@ class api_language extends api_core
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Add language strings to IPB language system
|
||||
// Äîáàâëåíèå ÿçûêîâûõ êîíñòðóêöèé â IPB
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Add language strings to the IPB language system
|
||||
* Äîáàâëÿåò ÿçûêîâûå êîíñòðóêöèè ê ñèñòåìå ÿçûêîâ IPB
|
||||
*
|
||||
* @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
|
||||
* @param array Ìàññèâ äîáàâëÿåìûõ êîíñòðóêöèé (ñòðóêòóðà ìàññèâà Êëþ÷ êîíñòðóêöèè => çíà÷åíèå)
|
||||
* @param string ßçûêîâîé ôàéë, êóäà äîáàâëÿåòñÿ êîíñòðóêöèÿ, íàï-ð: lang_global
|
||||
* @param string Ê êàêîìó ÿçûêîâîìó íàáîðó (ÿçûêó) äîáàâèòü êîíñòðóêöèþ ('all' âî âñå)
|
||||
* @return void;
|
||||
*/
|
||||
function lang_add_strings( $to_add=array(), $add_lang_file='', $add_where='all')
|
||||
@@ -161,7 +171,7 @@ class api_language extends api_core
|
||||
|
||||
$start .= "\n\n);\n\n?".">";
|
||||
|
||||
if ( $fh = fopen( $lang_file, 'w') )
|
||||
if ( $fh = @fopen( $lang_file, 'w') )
|
||||
{
|
||||
fwrite($fh, $start );
|
||||
fclose($fh);
|
||||
|
||||
+424
-404
@@ -1,405 +1,425 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-05-25 10:15:22 -0400 (Thu, 25 May 2006) $
|
||||
| > $Revision: 278 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Settings
|
||||
| > Module written by Brandon Farber
|
||||
| > Date started: Tuesday June 6th 2006 (11:12)
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Settings
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
* $api = new api_settings();
|
||||
* # Optional - if $ipsclass is not passed, it'll init
|
||||
* $api->ipsclass =& $this->ipsclass;
|
||||
* $api->api_init();
|
||||
* $api->update_settings( $path_to_xml_file );
|
||||
* </code>
|
||||
*
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Matt Mecham
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IPS_API_PATH' ) )
|
||||
{
|
||||
/**
|
||||
* Define classes path
|
||||
*/
|
||||
define( 'IPS_API_PATH', dirname(__FILE__) ? dirname(__FILE__) : '.' );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'api_core' ) )
|
||||
{
|
||||
require_once( IPS_API_PATH.'/api_core.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Settings
|
||||
*
|
||||
* This class deals with settings insertion functions
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @version 2.2
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class api_settings extends api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
//var $ipsclass;
|
||||
|
||||
var $xml;
|
||||
|
||||
var $setting_groups = array();
|
||||
var $setting_groups_by_key = array();
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Add settings to IPB (existing settings are updated)
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Adds or updates settings in IPB
|
||||
*
|
||||
* @param string Path to xml file containing settings
|
||||
* @param array Defaults for settings in XML file (key => value)
|
||||
* @param array Current values for settings in XML file (key => value)
|
||||
* @return void;
|
||||
*/
|
||||
function update_settings( $xml_file_path, $defaults=array(), $vals=array() )
|
||||
{
|
||||
//-------------------------------
|
||||
// Check?
|
||||
//-------------------------------
|
||||
|
||||
if ( !$xml_file_path )
|
||||
{
|
||||
$this->api_error[] = "input_missing_fields";
|
||||
return;
|
||||
}
|
||||
|
||||
require_once( KERNEL_PATH.'class_xml.php' );
|
||||
|
||||
$this->xml = new class_xml();
|
||||
|
||||
//-------------------------------
|
||||
// Get file contents
|
||||
//-------------------------------
|
||||
|
||||
$settings_content = implode( "", file($xml_file_path) );
|
||||
|
||||
if( !$settings_content )
|
||||
{
|
||||
$this->api_error[] = "invalid_file";
|
||||
return;
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
// Unpack the datafile (SETTINGS)
|
||||
//-------------------------------
|
||||
|
||||
$this->xml->xml_parse_document( $settings_content );
|
||||
|
||||
//-------------------------------
|
||||
// Get current settings.
|
||||
//-------------------------------
|
||||
|
||||
$cur_settings = array();
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'conf_id, conf_key',
|
||||
'from' => 'conf_settings',
|
||||
'order' => 'conf_id' ) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$cur_settings[ $r['conf_key'] ] = $r['conf_id'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get current titles
|
||||
//-----------------------------------------
|
||||
|
||||
$this->setting_get_groups();
|
||||
|
||||
//-----------------------------------------
|
||||
// pArse
|
||||
//-----------------------------------------
|
||||
|
||||
$fields = array( 'conf_title' , 'conf_description', 'conf_group' , 'conf_type' , 'conf_key' , 'conf_default',
|
||||
'conf_extra' , 'conf_evalphp' , 'conf_protected', 'conf_position', 'conf_start_group', 'conf_end_group',
|
||||
'conf_help_key', 'conf_add_cache' , 'conf_title_keyword' );
|
||||
|
||||
$setting_fields = array( 'conf_title_keyword', 'conf_title_title', 'conf_title_desc', 'conf_title_noshow' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! is_array( $this->xml->xml_array['settingexport']['settinggroup']['setting'][0] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Ensure [0] is populated
|
||||
//-----------------------------------------
|
||||
|
||||
$tmp = $this->xml->xml_array['settingexport']['settinggroup']['setting'];
|
||||
|
||||
unset($this->xml->xml_array['settingexport']['settinggroup']['setting']);
|
||||
|
||||
$this->xml->xml_array['settingexport']['settinggroup']['setting'][0] = $tmp;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop through and sort out settings...
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $this->xml->xml_array['settingexport']['settinggroup']['setting'] as $id => $entry )
|
||||
{
|
||||
$newrow = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Is setting?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $entry['conf_is_title']['VALUE'] )
|
||||
{
|
||||
foreach( $fields as $f )
|
||||
{
|
||||
$newrow[$f] = $entry[ $f ]['VALUE'];
|
||||
}
|
||||
|
||||
$new_settings[] = $newrow;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Is title?
|
||||
//-----------------------------------------
|
||||
|
||||
else
|
||||
{
|
||||
foreach( $setting_fields as $f )
|
||||
{
|
||||
$newrow[$f] = $entry[ $f ]['VALUE'];
|
||||
}
|
||||
|
||||
$new_titles[] = $newrow;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out titles...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $new_titles ) and count( $new_titles ) )
|
||||
{
|
||||
foreach( $new_titles as $idx => $data )
|
||||
{
|
||||
if ( $data['conf_title_title'] AND $data['conf_title_keyword'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get ID based on key
|
||||
//-----------------------------------------
|
||||
|
||||
$conf_id = $this->setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
|
||||
|
||||
$save = array( 'conf_title_title' => $data['conf_title_title'],
|
||||
'conf_title_desc' => $data['conf_title_desc'],
|
||||
'conf_title_keyword' => $data['conf_title_keyword'],
|
||||
'conf_title_noshow' => $data['conf_title_noshow'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Not got a row, insert first!
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $conf_id )
|
||||
{
|
||||
$this->ipsclass->DB->do_insert( 'conf_settings_titles', $save );
|
||||
$conf_id = $this->ipsclass->DB->get_insert_id();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( 'conf_settings_titles', $save, 'conf_title_id='.$conf_id );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update settings cache
|
||||
//-----------------------------------------
|
||||
|
||||
$save['conf_title_id'] = $conf_id;
|
||||
$this->setting_groups_by_key[ $save['conf_title_keyword'] ] = $save;
|
||||
$this->setting_groups[ $save['conf_title_id'] ] = $save;
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove need update...
|
||||
//-----------------------------------------
|
||||
|
||||
$need_update[] = $conf_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out settings
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $new_settings ) and count( $new_settings ) )
|
||||
{
|
||||
foreach( $new_settings as $idx => $data )
|
||||
{
|
||||
if( is_array( $vals ) AND count( $vals ) )
|
||||
{
|
||||
foreach( $vals as $k => $v )
|
||||
{
|
||||
if( $data['conf_key'] == $k )
|
||||
{
|
||||
$data['conf_value'] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( is_array( $defaults ) AND count( $defaults ) )
|
||||
{
|
||||
foreach( $defaults as $k => $v )
|
||||
{
|
||||
if( $data['conf_key'] == $k )
|
||||
{
|
||||
$data['conf_default'] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Make PHP slashes safe
|
||||
//-----------------------------------------
|
||||
|
||||
$data['conf_evalphp'] = str_replace( '\\', '\\\\', $data['conf_evalphp'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Now assign to the correct ID based on
|
||||
// our title keyword...
|
||||
//-----------------------------------------
|
||||
|
||||
$data['conf_group'] = $this->setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove from array
|
||||
//-----------------------------------------
|
||||
|
||||
unset( $data['conf_title_keyword'] );
|
||||
|
||||
if ( $cur_settings[ $data['conf_key'] ] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( 'conf_settings', $data, 'conf_id='.$cur_settings[ $data['conf_key'] ] );
|
||||
$updated++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INSERT
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'conf_settings', $data );
|
||||
$inserted++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update group counts...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $need_update ) )
|
||||
{
|
||||
foreach( $need_update as $id )
|
||||
{
|
||||
$conf = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) as count', 'from' => 'conf_settings', 'where' => 'conf_group='.$id ) );
|
||||
|
||||
$count = intval($conf['count']);
|
||||
|
||||
$this->ipsclass->DB->do_update( 'conf_settings_titles', array( 'conf_title_count' => $count ), 'conf_title_id='.$id );
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------
|
||||
// Update the settings cache
|
||||
//----------------------------
|
||||
|
||||
$this->ipsclass->cache['settings'] = array();
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'conf_settings', 'where' => 'conf_add_cache=1' ) );
|
||||
$info = $this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $r = $this->ipsclass->DB->fetch_row($info) )
|
||||
{
|
||||
$value = $r['conf_value'] != "" ? $r['conf_value'] : $r['conf_default'];
|
||||
|
||||
if ( $value == '{blank}' )
|
||||
{
|
||||
$value = '';
|
||||
}
|
||||
|
||||
$this->ipsclass->cache['settings'][ $r['conf_key'] ] = $this->ipsclass->txt_safeslashes($value);
|
||||
}
|
||||
|
||||
$this->ipsclass->update_cache( array( 'name' => 'settings', 'array' => 1, 'deletefirst' => 1 ) );
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// _Internal
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function setting_get_groups()
|
||||
{
|
||||
$this->setting_groups = array();
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'conf_settings_titles', 'order' => 'conf_title_title' ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$this->setting_groups[ $r['conf_title_id'] ] = $r;
|
||||
$this->setting_groups_by_key[ $r['conf_title_keyword'] ] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
+179
-129
@@ -2,14 +2,24 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| 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 $
|
||||
@@ -24,12 +34,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Skins
|
||||
* API: Ñòèëåé
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
|
||||
* <code>
|
||||
* $api = new api_skins();
|
||||
* # Optional - if $ipsclass is not passed, it'll init
|
||||
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
|
||||
* $api->ipsclass =& $this->ipsclass;
|
||||
* $api->api_init();
|
||||
* $api->skin_add_bits( $path_to_xml_file );
|
||||
@@ -39,28 +49,36 @@
|
||||
* $messages = $api->skin_rebuild_caches( $messages[0] );
|
||||
* </code>
|
||||
*
|
||||
* Macros for use with this file can be exported via the ACP
|
||||
* Skin Import/Export page
|
||||
* Ïðèìåð XML-ôàéëà ìàêðîñîâ ìîæíî ïîëó÷èòü ýêñïîðòðîâàíèåì èç
|
||||
* ÀÖÏ ñ ïîìîùüþ èíñòðóìåíòà "Èìïîðò è ýêñïîðò ñòèëåé"
|
||||
*
|
||||
* 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.
|
||||
* XML-ôàéë ñ øàáëîíàìè ìîæíî ïîëó÷èòü ýêñïîðòðîâàíèåì èç ÀÖÏ â
|
||||
* IN_DEV ðåæèìå. Íåîáõîäèìî çàéòè â Óïðàâëåíèå ñòèëÿìè ->
|
||||
* Ñïèñîê ñòèëåé è âîñïîëüçîâàòüñÿ èíñòðóìåíòàìè èç ðàçäåëà
|
||||
* Ýêñïîðòèðîâàíèå äàííûõ.
|
||||
*
|
||||
* Example - if you make a skin_links skin template file, enter
|
||||
* "links" in the form field and download the xml file.
|
||||
* Òàê æå ìîæíî ýêñïîðòèðîâàòü øàáëîíû òîëüêî îïðåäåëåííîé ãðóïïû
|
||||
* Ðåæèì ðàçðàáîò÷èêà: ýêñïîðòèðîâàíèå ôàéëîâ ñòèëÿ
|
||||
* Íàïðèìåð åñëè âû õîòèòå âñå øàáëîíû ãðóïïû skin_links, òî
|
||||
* ââåäèòå â ïîëå çíà÷åíèå 'links'
|
||||
*
|
||||
* Ìåòîä skin_rebuild_caches ïîçâîëÿåò ñîçäàòü íîâûå êåø ôàéëû (php
|
||||
* ôàéëû ñòèëÿ íà äèñêå) äëÿ îäíîãî ñòèëÿ çà ðàç. Ìåòîä ïåðåñòðàèâàåò
|
||||
* ñòèëü id êîòîðîãî âûøå, ÷åì id ïåðåäàííîãî â ôóíêöèþ.
|
||||
* Ïðè ïåðâîì âûçîâå ìåòîäà, ïåðåäàâàéòå åìó íóëåâîé ïàðàìåòð íà âõîä.
|
||||
* Âî âñåõ ïîñëåäóþùèõ âûçîâàõ ïîäàâàéòå íà âõîä 1-å çíà÷åíèå èç
|
||||
* ìàññèâà (èíäåêñ 0), êîòîðûé áûë âîçâðàùåí ïðåäûäóùèì âûçîâîì ìåòîäà.
|
||||
* Äàííûé ïîäõîä ïîçâîëÿåò ïåðåñòðàèâàòü âñå ñòèëè ôîðóìà è èçáåæàòü
|
||||
* òàéì-àóòîâ ïðè âûïîëíåíèè ýòîé îïåðàöèè. Ñîâåòóåì èñïîëüçîâàòü ýòó
|
||||
* îñîáåííîñòü â âàøèõ ñêðèïòàõ òàê - ñêðèïò äîëæåí äåëàòü ðèäåðåêò íà
|
||||
* ñåáÿ ñàìîãî ïîñëå êàæäîãî ïåðåñòðîåíèÿ ñòèëÿ, ïðè ýòîì â ïàðàìåòðàõ
|
||||
* ðåäèðåêòà íåîáõîäèìî ïåðåäàâàòü ðåçóëüòàò, êîòîðûé âåðíóë ìåòîä
|
||||
* skin_rebuild_caches. Êîãäà ïåðâîå çíà÷åíèå â âåðíóâøåìñÿ ìàññèâå
|
||||
* áóäåò èìåòü çíà÷åíèå 0 âñå øàáëîíû âñåõ ñòèëåé áóäóò ïåðåñòðîåíû,
|
||||
* à çíà÷èò ìîæíî çàâåðøàòü ðàáîòó ñêðèïòà. Òàê æå âàæíî ïîìíèòü, ÷òî
|
||||
* âòîðîå çíà÷åíèå â âîçâðàùàåìîì ìàññèâå (èíäåêñ 1) ñîäåðæèò ìàññèâ
|
||||
* ñîîáùåíèé.
|
||||
*
|
||||
* 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
|
||||
@@ -83,9 +101,9 @@ if ( ! class_exists( 'api_core' ) )
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Skins
|
||||
* API: Ñòèëåé
|
||||
*
|
||||
* This class deals with all available skin insertion functions.
|
||||
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ äîáàâëåíèÿ ñòèëåé.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
@@ -101,20 +119,19 @@ class api_skins extends api_core
|
||||
* @var object
|
||||
*/
|
||||
//var $ipsclass;
|
||||
|
||||
|
||||
var $xml;
|
||||
var $cache_func;
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Add skin templates to IPB
|
||||
// Äîáàâëåíèå øàáëîíîâ ñòèëÿ IPB
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Adds skin templates to IPB master template set which will filter down to child skins
|
||||
* Äîáàâëÿåò øàáëîíû â ãëàâíûé ñòèëü IPB, øàáëîíû ïîòîì äîñòóïíû è ñòèëÿì-íàñëåäíèêàì
|
||||
*
|
||||
* @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)
|
||||
* @param string Ïóòü ê xml, ñîäåðæàùåìó øàáëîíû (Ïîäñêàçêà: ïðèìåð xml
|
||||
* ìîæíî ïîëó÷èòü ýêñïîðòðîâàíèåì èç ÀÖÏ â IN_DEV ðåæèìå)
|
||||
* @return void;
|
||||
*/
|
||||
function skin_add_bits( $xml_file_path )
|
||||
@@ -122,33 +139,47 @@ 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
|
||||
//-------------------------------
|
||||
|
||||
//-------------------------------
|
||||
|
||||
$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'][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;
|
||||
}
|
||||
|
||||
if ( ! is_array( $this->xml->xml_array['templateexport']['templategroup']['template'] ) )
|
||||
{
|
||||
$this->api_error[] = "xml_file_not_valid";
|
||||
@@ -158,7 +189,7 @@ class api_skins extends api_core
|
||||
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"
|
||||
@@ -167,7 +198,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()
|
||||
@@ -177,7 +208,7 @@ 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'],
|
||||
@@ -188,16 +219,16 @@ class api_skins extends api_core
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Add macros to IPB
|
||||
// Äîáàâëåíèå ìàêðîñîâ IPB
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Adds macros to IPB master templates which will filter down to child skins
|
||||
* Äîáàâëÿåò ìàêðîñû â ãëàâíûé ñòèëü IPB, ìàêðîñû ïîòîì äîñòóïíû è ñòèëÿì-íàñëåäíèêàì
|
||||
*
|
||||
* @param string Path to xml file containing macros (Note: macros can
|
||||
* be exported from ACP when IN_DEV mode is enabled)
|
||||
* @param string Ïóòü ê xml, ñîäåðæàùåìó ìàêðîñû (Ïîäñêàçêà: ïðèìåð xml
|
||||
* ìîæíî ïîëó÷èòü ýêñïîðòðîâàíèåì èç ÀÖÏ â IN_DEV ðåæèìå)
|
||||
* @return void;
|
||||
*/
|
||||
function skin_add_macros( $xml_file_path )
|
||||
@@ -205,29 +236,44 @@ 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 (TEMPLATES)
|
||||
//-------------------------------
|
||||
|
||||
$this->xml->xml_parse_document( $macro_content );
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------
|
||||
// (MACRO)
|
||||
//-------------------------------
|
||||
@@ -241,7 +287,7 @@ class api_skins extends api_core
|
||||
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"
|
||||
@@ -249,35 +295,38 @@ 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
|
||||
// Ïåðåñîçäàíèå êåøà ñòèëåé
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Rebuilds template caches to cache new skins to .php files
|
||||
* Ñîçäàåò íîâûå .php ôàéëû êåøà äëÿ øàáëîíîâ ñòèëÿ.
|
||||
*
|
||||
* @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
|
||||
* @param int id ïîñëåäíåãî ïåðåñîçäàííîãî ñòèëÿ
|
||||
* @return array Âîçâðàùàåò ìàññèâ, ñîäåðæàùèé:
|
||||
* - id îáðàáîòàííîãî ñòèëÿ (è ñíîâà ìîæåò áûòü ïåðåäàíî
|
||||
* íà âõîä ýòîé ôóíêöèè äëÿ ïðîäîëæåíèÿ îáíîâëåíèÿ êåøåé äðóãèõ
|
||||
* ñòèëåé)
|
||||
* - ìàññèâ ñîîáùåíèé
|
||||
*/
|
||||
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
|
||||
//-----------------------------------
|
||||
@@ -285,26 +334,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
|
||||
//-----------------------------------
|
||||
@@ -332,62 +381,62 @@ class api_skins extends api_core
|
||||
}
|
||||
else
|
||||
{
|
||||
return array( 'completed' => 0, 'messages' => array( 'No more skins to rebuild' ) );
|
||||
return array( 'completed' => 0, 'messages' => array( 'Íåò áîëüøå ñòèëåé äëÿ ïåðåñîçäàíèÿ êåøà' ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Rebuild update template bit
|
||||
// Îáíîâëåíèå êåøà øàáëîíîâ äî íîâîé âåðñèè
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Updates a template bit from a previous version to the current version
|
||||
* NOTE: This only changes the format of the data and doesn't update the
|
||||
* actual HTML.
|
||||
* Îáíîâëÿåò øàáëîíû ïðåäûäóùåé âåðñèè äî òåêóùåé
|
||||
* Ïðèìå÷àíèå: ìåòîä èçìåíÿåò òîëüêî ôîðìàò øàáëîíîâ, íî íå èçìåíÿåò ñàì HTML
|
||||
* øàáëîíîâ
|
||||
*
|
||||
* @param string Template HTML
|
||||
* @return string Template HTML
|
||||
* @param string HTML-òåëî øàáëîíà
|
||||
* @return string 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 );
|
||||
$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 );
|
||||
$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 );
|
||||
|
||||
$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 );
|
||||
|
||||
|
||||
$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===================================================";
|
||||
@@ -396,21 +445,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
|
||||
@@ -427,18 +476,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] );
|
||||
@@ -460,11 +509,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";
|
||||
@@ -495,18 +544,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 );
|
||||
@@ -515,41 +564,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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,220 @@
|
||||
<?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: Tasks
|
||||
| > Module written by Brandon Farber
|
||||
| > Date started: Oct 25th 2006 (15:16 EST)
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Ìåíåäæåðà çàäà÷
|
||||
*
|
||||
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
|
||||
* <code>
|
||||
* $api = new api_tasks();
|
||||
* # Îïöèîíàëüíî - åñëè $ipsclass íå ïåðåäàåòñÿ â îáúåêò, îí áóäåò èíèöèàëèçèðîâàí ñàìîñòîÿòåëüíî
|
||||
* $api->ipsclass =& $this->ipsclass;
|
||||
* $api->api_init();
|
||||
* $api->add_task( $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_tasks extends api_core
|
||||
{
|
||||
/**
|
||||
* Îáúåêò ñóïåð-êëàññà IPS
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
//var $ipsclass;
|
||||
|
||||
var $xml;
|
||||
var $error = '';
|
||||
|
||||
var $updated = 0;
|
||||
var $inserted = 0;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Äîáàâëåíèå çàäà÷/Ñîçäàíèå íîâîãî ñïèñêà çàäà÷
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Äîáàâëÿåò çàäà÷ó â ïëàíèðîâùèê IPB, èëè ñîçäàåò íîâûé ñïèñîê çàäà÷ èç XML
|
||||
*
|
||||
* @param string Ïóòü ê xml-ôàéëó ñî ñïèñêîì çàäà÷
|
||||
* @return void;
|
||||
*/
|
||||
function add_task( $xml_file_path='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$file = $xml_file_path ? $xml_file_path : ROOT_PATH . 'resources/tasks.xml';
|
||||
$inserted = 0;
|
||||
$updated = 0;
|
||||
$tasks = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! file_exists( $file ) )
|
||||
{
|
||||
$this->error = 'no_file';
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get current task info
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => '*',
|
||||
'from' => 'task_manager' ) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
while( $row = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$tasks[ $row['task_key'] ] = $row;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get XML
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( KERNEL_PATH.'class_xml.php' );
|
||||
$xml = new class_xml();
|
||||
$xml->lite_parser = 1;
|
||||
|
||||
//-----------------------------------------
|
||||
// Get XML file (TASKS)
|
||||
//-----------------------------------------
|
||||
|
||||
$task_xml = implode( "", file($file) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Unpack the datafile
|
||||
//-----------------------------------------
|
||||
|
||||
$xml->xml_parse_document( $task_xml );
|
||||
|
||||
if ( ! is_array( $xml->xml_array['export']['group']['row'][0] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// 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;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// TASKS
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $xml->xml_array['export']['group']['row'] as $id => $entry )
|
||||
{
|
||||
$newrow = array();
|
||||
|
||||
$_key = $entry['task_key']['VALUE'];
|
||||
|
||||
foreach( $entry as $f => $data )
|
||||
{
|
||||
if ( $f == 'VALUE' or $f == 'task_id' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $f == 'task_cronkey' )
|
||||
{
|
||||
$entry[ $f ]['VALUE'] = $tasks[ $_key ]['task_cronkey'] ? $tasks[ $_key ]['task_cronkey'] : md5( uniqid( microtime() ) );
|
||||
}
|
||||
|
||||
if ( $f == 'task_next_run' )
|
||||
{
|
||||
$entry[ $f ]['VALUE'] = $tasks[ $_key ]['task_next_run'] ? $tasks[ $_key ]['task_next_run'] : time();
|
||||
}
|
||||
|
||||
$newrow[$f] = $entry[ $f ]['VALUE'];
|
||||
}
|
||||
|
||||
if ( $tasks[ $_key ]['task_key'] )
|
||||
{
|
||||
$this->updated++;
|
||||
$this->ipsclass->DB->do_update( 'task_manager', $newrow, "task_key='" . $tasks[ $_key ]['task_key'] . "'" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->inserted++;
|
||||
$this->ipsclass->DB->do_insert( 'task_manager', $newrow );
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -2,14 +2,24 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| 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: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
|
||||
| > $Revision: 23 $
|
||||
@@ -24,24 +34,22 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Forums
|
||||
* API: Ôîðóìîâ
|
||||
*
|
||||
* 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();
|
||||
// Loop on $topics and output the data
|
||||
// Ïðîéòè ìàññèâ $topics è âûâåñòè äàííûå
|
||||
* </code>
|
||||
*
|
||||
* API will return attachment data in an array
|
||||
* attachment_data - you are responsible for any
|
||||
* processing or displaying if you wish to do so
|
||||
* API âîçâðàùàåò èíôîðìàöèþ î ïðèêðåïëåííûõ ôàéëàõ â ìàññèâå
|
||||
* attachment_data
|
||||
*
|
||||
* Attachment data returned will be in an array with the
|
||||
* topic/post data like so:
|
||||
* Ñòðóêòóðà ìàññèâà ïðèêðåïëåííûõ ôàéëîâ:
|
||||
|
||||
[attachment_data] => Array
|
||||
(
|
||||
@@ -60,12 +68,14 @@
|
||||
)
|
||||
|
||||
)
|
||||
* You can then loop on the attachment_data key (if
|
||||
* it exists - it won't exist if there are no attachments)
|
||||
* and process each attachment in the record.
|
||||
* Ïåðåáèðàÿ êëþ÷è ìàññèâà attachment_data (åñëè îíè
|
||||
* ñóùåñòâóþò - åñëè íåò, òî íåò è ïðèêðåïëåííûõ ôàéëîâ)
|
||||
* ìîæíî îáðàáîòàòü êàæäûé ïðèêðåïëåííûé ôàéë.
|
||||
*
|
||||
* Attachment types - thumb = thumbnail, image = regular image
|
||||
* reg = regular attachment
|
||||
* Òèïû ïðèêðåïëåííûõ ôàéëîâ ( çíà÷åíèÿ types):
|
||||
* thumb = ýñêèç,
|
||||
* image = èçîáðàæåíèå,
|
||||
* reg = ôàéë
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
@@ -88,9 +98,9 @@ if ( ! class_exists( 'api_core' ) )
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Languages
|
||||
* API: Ôîðóìîâ
|
||||
*
|
||||
* This class deals with all available language functions.
|
||||
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ ðàáîòû ñ âûâîäîì òåì.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
@@ -101,34 +111,35 @@ if ( ! class_exists( 'api_core' ) )
|
||||
class api_topic_view extends api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
* Îáúåêò ñóïåð-êëàññà IPS
|
||||
*
|
||||
* @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' => 1, // èç êàêèõ ôîðóìîâ áðàòü òåìû (ìîæåò áûòü ìàññèâîì)
|
||||
'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 Array of topic data
|
||||
* @return array Ìàññèâ ñ äàííûìè òåì
|
||||
*/
|
||||
function return_topic_list_data()
|
||||
{
|
||||
|
||||
@@ -2,18 +2,28 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| 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
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
|
||||
| > $Revision: 567 $
|
||||
| > $Author: matt $
|
||||
| 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 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Topics and Posts
|
||||
@@ -24,26 +34,30 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
* ÂÍÈÌÀÍÈÅ: Ìåòîäû äàííîãî API ÍÅ ÏÐÎÂÅÐßÞÒ ïðàâà ïîëüçîâàòåëåé
|
||||
* Ïî ýòîìó ïðè íåïðàâèëüíîì èñïîëüçîâàíèè ìåòîäîâ âîçìîæíû îòâåòû
|
||||
* ïîëüçîâàòåëÿ â çàêðûòûå òåìû, à òàê æå ñîçäàíèå íîâûõ òåì è
|
||||
* ñîîáùåíèé â ôîðóìàõ, ê êîòîðûì ïîëüçîâàòåëü íåò èìååò äîñòóïà.
|
||||
* Äëÿ èçáåæàíèÿ òàêèõ ýôôåêòîâ ÎÁßÇÀÒÅËÜÍÎ ïðîâåðÿéòå ïðàâà
|
||||
* ïîëüçîâàòåëÿ ïðåæäå ÷åì âûçûâàòü ìåòîä.
|
||||
*
|
||||
* ÏÐÈÌÅÐ ÈÑÏÎËÜÇÎÂÀÍÈß
|
||||
* <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 );
|
||||
* # Default for show_signature is 1, added here for completeness
|
||||
* # Ïî-óìîë÷àíèþ ôëàã show_signature âñåãäà 1, çäåñü äîáàâëåíî äëÿ ïîëíîòû ôîðìû
|
||||
* $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 );
|
||||
@@ -74,9 +88,9 @@ if ( ! class_exists( 'api_core' ) )
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Topics & Posts
|
||||
* API: Ñîçäàíèå ñîîáùåíèé è òåì
|
||||
*
|
||||
* This class deals with all showing, creating and editing topics and posts
|
||||
* Êëàññ ïðåäîñòàâëÿåò âñå ìåòîäû API äëÿ ñîçäàíèÿ òåì è ñîîáùåíèé.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
@@ -87,101 +101,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 = "";
|
||||
|
||||
/**
|
||||
* Topic ID
|
||||
* ID òåìû
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
var $topic_id = "";
|
||||
|
||||
/**
|
||||
* Set forum ID
|
||||
* 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
|
||||
* Ôëàã îòëîæåííîãî îáíîâëåíèÿ êåøà
|
||||
*
|
||||
* If set to 1, you will need to manually
|
||||
* rebuild topic info and forum info.
|
||||
* Åñëè ôëàã óñòàíîâëåí â 1, âàì áóäåò íåîáõîäèìî
|
||||
* ñàìèì îáíîâèòü âñå ñ÷åò÷èêè òåì, ôîðóìîâ è ñòàòèñòèêè.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
@@ -195,7 +209,7 @@ class api_topics_and_posts extends api_core
|
||||
'parse_html' => 0 );
|
||||
|
||||
/**
|
||||
* Topic settings
|
||||
* Íàñòðîéêè òåìû
|
||||
*
|
||||
* @var array topic_date, post_icon_id
|
||||
*/
|
||||
@@ -203,45 +217,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
|
||||
*/
|
||||
@@ -321,10 +335,10 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Create new topic
|
||||
// Ñîçäàíèå íîâîãî îòâåòà â òåìó
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Create new topic
|
||||
* Ñîçäàåò íîâóþ òåìó
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -417,12 +431,12 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set topic: title
|
||||
// Óñòàíîâêà íàçâàíèÿ òåìû
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Set topic title
|
||||
* Óñòàíàâëèâàåò íàçâàíèå äëÿ ñîçäàâàåìîé òåìû
|
||||
*
|
||||
* @param string Incoming
|
||||
* @param string Íàçâàíèå òåìû
|
||||
* @return void
|
||||
*/
|
||||
function set_topic_title( $data )
|
||||
@@ -431,12 +445,12 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set topic: desc
|
||||
// Óñòàíîâêà îïèñàíèÿ òåìû
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Set topic description
|
||||
* Óñòàíàâëèâàåò îïèñàíèå äëÿ ñîçäàâàåìîé òåìû
|
||||
*
|
||||
* @param string Incoming
|
||||
* @param string Îïèñàíèå òåìû
|
||||
* @return void
|
||||
*/
|
||||
function set_topic_description( $data )
|
||||
@@ -445,12 +459,12 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set topic: state
|
||||
// Óñòàíîâêà ñòàòóñà òåìû
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Set topic state
|
||||
* Óñòàíàâëèâàåò ñòàòóñà äëÿ ñîçäàâàåìîé òåìû
|
||||
*
|
||||
* @param string Incoming
|
||||
* @param string Ñòàòóñ (open/closed)
|
||||
* @return void
|
||||
*/
|
||||
function set_topic_state( $data )
|
||||
@@ -459,12 +473,12 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set topic: pinned
|
||||
// Óñòàíîâêà âàæíîñòè òåìû
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Set topic pinned
|
||||
* Óñòàíàâëèâàåò âàæíîñòü äëÿ ñîçäàâàåìîé òåìû
|
||||
*
|
||||
* @param string Incoming
|
||||
* @param string Ïðèêðåïëåíà / íå ïðèêðåïëåíà (1 / 0)
|
||||
* @return void
|
||||
*/
|
||||
function set_topic_pinned( $data )
|
||||
@@ -473,12 +487,12 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set topic: invisible
|
||||
// Óñòàíîâêà âèäèìîñòè òåìû
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Set topic pinned
|
||||
* Óñòàíàâëèâàåò âèäèìîñòü äëÿ ñîçäàâàåìîé òåìû
|
||||
*
|
||||
* @param string Incoming
|
||||
* @param string Òåìà îïóáëèêîâàíà / íå îïóáëèêîâàíà (0 / 1)
|
||||
* @return void
|
||||
*/
|
||||
function set_topic_invisible( $data )
|
||||
@@ -487,13 +501,13 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set post content
|
||||
// Óñòàíîâêà ñîäåðæèìîãî ñîîáùåíèÿ
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Set the post content
|
||||
* Óñòàíàâëèâàåò ñîäåðæèìîå ñîîáùåíèÿ äëÿ ñîçäàâàåìîé òåìû/ñîîáùåíèÿ
|
||||
*
|
||||
* @param string post content
|
||||
* @return boolean populates $this->post_content
|
||||
* @param string ñîäåðæèìîå ñîîáùåíèÿ
|
||||
* @return boolean èíèöèàëèçàöèÿ $this->post_content
|
||||
*/
|
||||
function set_post_content( $post )
|
||||
{
|
||||
@@ -524,13 +538,14 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set author by user_name
|
||||
// Óñòàíîâêà àâòîðà ïî èìåíè ïîëüçîâàòåëÿ
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Get a member from the DB by username
|
||||
* Ïîëó÷àåò èíôîðìàöèþ î ïîëüçîâàòåëå è óñòàíàâëèâàåò àâòîðà
|
||||
* òåìû/ñîîáùåíèÿ ïî èìåíè ïîëüçîâàòåëÿ
|
||||
*
|
||||
* @param string user name
|
||||
* @return boolean populates $this->author
|
||||
* @param string èìÿ ïîëüçîâàòåëÿ
|
||||
* @return boolean èíèöèàëèçàöèÿ $this->author
|
||||
*/
|
||||
function set_author_by_name( $user_name )
|
||||
{
|
||||
@@ -550,13 +565,14 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set author by id
|
||||
// Óñòàíîâêà àâòîðà ïî id ïîëüçîâàòåëÿ
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Get a member from the DB by ID
|
||||
/**
|
||||
* Ïîëó÷àåò èíôîðìàöèþ î ïîëüçîâàòåëå è óñòàíàâëèâàåò àâòîðà
|
||||
* òåìû/ñîîáùåíèÿ ïî ID ïîëüçîâàòåëÿ
|
||||
*
|
||||
* @param integer User ID
|
||||
* @return boolean populates $this->author
|
||||
* @param integer ID ïîëüçîâàòåëÿ
|
||||
* @return boolean èíèöèàëèçàöèÿ $this->author
|
||||
*/
|
||||
function set_author_by_id( $id )
|
||||
{
|
||||
@@ -576,13 +592,14 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set author by display_name
|
||||
// Óñòàíîâêà àâòîðà ïî îòîáðàæàåìîìó èìåíè ïîëüçîâàòåëÿ
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Get a member from the DB by display name
|
||||
* Ïîëó÷àåò èíôîðìàöèþ î ïîëüçîâàòåëå è óñòàíàâëèâàåò àâòîðà
|
||||
* òåìû/ñîîáùåíèÿ ïî îòîáðàæàåìîìó èìåíè ïîëüçîâàòåëÿ
|
||||
*
|
||||
* @param string member display name
|
||||
* @return boolean populates $this->author
|
||||
* @param string îòîáðàæàåìîå èìÿ ïîëüçîâàòåëÿ
|
||||
* @return boolean èíèöèàëèçàöèÿ $this->author
|
||||
*/
|
||||
function set_author_by_display_name( $display_name )
|
||||
{
|
||||
@@ -601,13 +618,14 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set topic by id
|
||||
// Óñòàíîâêà òåìû ïî id
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Get a topic from the DB by ID and set the current topic id
|
||||
* Ïîëó÷àåò èíôîðìàöèþ î òåìå èç áàçû è óñòàíàâëèâàåò
|
||||
* òåêóùóþ òåìó ïî ID òåìû
|
||||
*
|
||||
* @param integer Topic
|
||||
* @return boolean populates $this->author
|
||||
* @param integer ID òåìû
|
||||
* @return boolean èíèöèàëèçàöèÿ $this->author
|
||||
*/
|
||||
function set_topic_id( $id )
|
||||
{
|
||||
@@ -639,13 +657,14 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Set author by id
|
||||
// Óñòàíîâêà ôîðóìà ïî id
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Get DB info and set forum ID
|
||||
* Ïîëó÷àåò èíôîðìàöèþ î ôîðóìå è óñòàíàâëèâàåò
|
||||
* òåêóùèé ôîðóì ïî ID ôîðóìà
|
||||
*
|
||||
* @param integer Topic
|
||||
* @return boolean populates $this->author
|
||||
* @param integer ID ôîðóìà
|
||||
* @return boolean èíèöèàëèçàöèÿ $this->author
|
||||
*/
|
||||
function set_forum_id( $id )
|
||||
{
|
||||
@@ -667,23 +686,25 @@ class api_topics_and_posts extends api_core
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$perms = unserialize( $this->forum['permission_array'] );
|
||||
$perms = unserialize( stripslashes( $this->forum['permission_array'] ) );
|
||||
|
||||
$this->forum['read_perms'] = $perms['read_perms'];
|
||||
$this->forum['reply_perms'] = $perms['reply_perms'];
|
||||
$this->forum['start_perms'] = $perms['start_perms'];
|
||||
$this->forum['upload_perms'] = $perms['upload_perms'];
|
||||
$this->forum['show_perms'] = $perms['show_perms'];
|
||||
$this->forum['read_perms'] = $perms['read_perms'];
|
||||
$this->forum['reply_perms'] = $perms['reply_perms'];
|
||||
$this->forum['start_perms'] = $perms['start_perms'];
|
||||
$this->forum['upload_perms'] = $perms['upload_perms'];
|
||||
$this->forum['download_perms'] = $perms['download_perms'];
|
||||
$this->forum['show_perms'] = $perms['show_perms'];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Rebuild forum stats
|
||||
// Îáíîâëåíèå ñ÷åò÷èêîâ ôîðóìà
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Rebuilds the forum stats
|
||||
* Îáíîâëÿåò êåøè ñ÷åò÷èêîâ òåì è ñîîáùåíèé ôîðóìà ñ óêàçàííûì ID
|
||||
*
|
||||
* @param integer ID ôîðóìà
|
||||
* @return void
|
||||
*/
|
||||
function tap_rebuild_forum( $forum_id )
|
||||
@@ -702,10 +723,10 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Rebuild stats
|
||||
// Îáíîâëåíèå ñòàòèñòèêè ôîðóìà
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Rebuilds the global stats
|
||||
* Îáíîâëÿåò êåø ãëîáàëüíîé ñòàòèñòèêè ôîðóìà
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -725,10 +746,10 @@ class api_topics_and_posts extends api_core
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Add language strings to IPB language system
|
||||
// Ïîäêëþ÷åíèå êëàññîâ ñèñòåìû
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Loads required classes...
|
||||
* Ïîäêëþ÷àåò íåîáõîäèìûå êëàññû äëÿ ðàáîòû ñèñòåìû îòïðàâêè ñîîáùåíèé/òåì
|
||||
*
|
||||
* @return void;
|
||||
*/
|
||||
|
||||
@@ -1,220 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-06-26 22:03:22 -0400 (Wed, 26 July 2006) $
|
||||
| > $Revision: 1 $
|
||||
| > $Author: w1lz0r $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Blog
|
||||
| > Module written by Remco Wilting
|
||||
| > Date started: Wednesday July 26th 2006 (21:22)
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Blog
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
* $api = new api_blog();
|
||||
* # Optional - if $ipsclass is not passed, it'll init
|
||||
* $api->ipsclass =& $this->ipsclass;
|
||||
* $api->api_init();
|
||||
* $api->get_blog_id( $member_id );
|
||||
* $api->last_x_entries( $blog_id, $number_of_entries );
|
||||
* </code>
|
||||
*
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Matt Mecham
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IPS_API_PATH' ) )
|
||||
{
|
||||
/**
|
||||
* Define classes path
|
||||
*/
|
||||
define( 'IPS_API_PATH', dirname(__FILE__) ? dirname(__FILE__) : '.' );
|
||||
}
|
||||
|
||||
if ( ! defined( 'BLOG_PATH' ) )
|
||||
{
|
||||
define( 'BLOG_PATH', ROOT_PATH.'modules/blog/' );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'api_core' ) )
|
||||
{
|
||||
require_once( IPS_API_PATH.'/api_core.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Blog
|
||||
*
|
||||
* This class deals with settings insertion functions
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @version 2.2
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class api_blog extends api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
var $blog_std;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Retrieve the Blog ID of a member
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Retrieve the Blog ID of a member
|
||||
*
|
||||
* @param int Member ID
|
||||
* @return int Blog ID ( 0 if no Blog found )
|
||||
*/
|
||||
function get_blog_id( $member_id=0 )
|
||||
{
|
||||
$member_id = intval( $member_id );
|
||||
|
||||
//-----------------------------------------
|
||||
// We entered here on member id, find blog_id and redirect them to here
|
||||
//-----------------------------------------
|
||||
$blog = $this->ipsclass->DB->build_and_exec_query( array ( 'select' => 'blog_id, blog_name, blog_friendly_url',
|
||||
'from' => 'blog_blogs',
|
||||
'where' => "member_id={$member_id}" ) );
|
||||
if ( !$blog['blog_id'] or !$blog['blog_name'] )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $blog['blog_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Retrieve the last x entries of a Blog
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Retrieve the last x entries of a Blog
|
||||
* Only public publishes entries are returned
|
||||
*
|
||||
* @param int Blog ID
|
||||
* @param int Number of entries (to return)
|
||||
* @return array Array of last X entries
|
||||
*/
|
||||
|
||||
function last_x_entries( $blog_id, $number_of_entries=10 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load the Blog functions library
|
||||
//-----------------------------------------
|
||||
require_once ( BLOG_PATH.'lib/lib_blogfunctions.php' );
|
||||
$this->blog_std = new blog_functions;
|
||||
$this->blog_std->ipsclass = & $this->ipsclass;
|
||||
|
||||
//-----------------------------------------
|
||||
// Build the permissions
|
||||
//-----------------------------------------
|
||||
$this->blog_std->build_perms();
|
||||
|
||||
if ( $this->ipsclass->check_perms($this->ipsclass->vars['blog_view_perms']) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Private Club Authed?
|
||||
//-----------------------------------------
|
||||
$extra = "";
|
||||
$allowguests = "";
|
||||
if ( !$this->ipsclass->member['id'] )
|
||||
{
|
||||
$allowguests .= " AND b.blog_allowguests = 1";
|
||||
}
|
||||
if ( !$this->ipsclass->member['_blogmod']['moderate_can_view_private'] )
|
||||
{
|
||||
$levelwhere = array( '(bc.blog_id IS NULL)' );
|
||||
if ( $this->ipsclass->member['_cache']['my_blog'] )
|
||||
{
|
||||
$levelwhere[] = "(b.blog_id = {$this->ipsclass->member['_cache']['my_blog']})";
|
||||
}
|
||||
if ( $this->ipsclass->member['_cache']['my_blog'] )
|
||||
{
|
||||
$levelwhere[] = "(bc.category_type = 'private' AND bc.blog_id={$this->ipsclass->member['_cache']['my_blog']})";
|
||||
}
|
||||
if ( is_array($this->ipsclass->member['g_blog_authed_blogs']) && count($this->ipsclass->member['g_blog_authed_blogs'])>1 )
|
||||
{
|
||||
$authblogs = implode(",", $this->ipsclass->member['g_blog_authed_blogs']);
|
||||
$levelwhere[] = "(bc.category_type = 'privateclub' AND bc.blog_id in(".$authblogs."))";
|
||||
$levelwhere[] = "(bc.category_type = 'public')";
|
||||
}
|
||||
else
|
||||
{
|
||||
$authblogs = "";
|
||||
$levelwhere[] = "(bc.category_type = 'public')";
|
||||
}
|
||||
$extra = "b.blog_private=0";
|
||||
if ($authblogs)
|
||||
{
|
||||
$extra = "(".$extra." or b.blog_id in(".$authblogs.($this->ipsclass->member['_cache']['my_blog']?",".$this->ipsclass->member['_cache']['my_blog']:"")."))";
|
||||
}
|
||||
elseif ( $this->ipsclass->member['_cache']['my_blog'] )
|
||||
{
|
||||
$extra = "(".$extra." or b.blog_id = {$this->ipsclass->member['_cache']['my_blog']})";
|
||||
}
|
||||
$extra = " AND ".$extra;
|
||||
$leveljoin = " AND (".implode( " or ", $levelwhere ).")";
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => "e.*",
|
||||
'from' => array('blog_entries' => 'e'),
|
||||
'add_join'=> array( 0 => array( 'select' => 'b.blog_name, b.blog_friendly_url',
|
||||
'from' => array( 'blog_blogs' => 'b' ),
|
||||
'where' => "e.blog_id=b.blog_id",
|
||||
'type' => 'left'
|
||||
),
|
||||
1 => array( 'from' => array( 'blog_categories' => 'bc' ),
|
||||
'where' => "e.blog_id=bc.blog_id and e.category_id=bc.category_id",
|
||||
'type' => 'left'
|
||||
) ),
|
||||
'where' => "b.blog_id = ".intval($blog_id)." AND e.entry_status='published' ".$allowguests.$extra.$leveljoin,
|
||||
'order' => 'e.entry_date DESC',
|
||||
'limit' => array(0, intval($number_of_entries) )
|
||||
) );
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
$return_array = array();
|
||||
while ( $entry = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$entry['blog_url'] = $this->blog_std->get_blog_url( $entry['blog_id'], $entry['blog_friendly_url'] );
|
||||
$entry['entry_url'] = $entry['blog_url'].'eid='.$entry['entry_id'];
|
||||
$return_array[] = $entry;
|
||||
}
|
||||
return $return_array;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,189 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
|
||||
| > $Revision: 23 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: Gallery last 5 submissions
|
||||
| > Module written by Brandon Farber
|
||||
| > Date started: Wednesday 7/26/2006
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: Gallery
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
* To follow
|
||||
* </code>
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IPS_API_PATH' ) )
|
||||
{
|
||||
/**
|
||||
* Define classes path
|
||||
*/
|
||||
define( 'IPS_API_PATH', dirname(__FILE__) ? dirname(__FILE__) : '.' );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'api_core' ) )
|
||||
{
|
||||
require_once( IPS_API_PATH.'/api_core.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* API: Gallery
|
||||
*
|
||||
* This class will pull the last 5 images a user has submitted to Gallery.
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @version 2.1
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class api_gallery extends api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
//var $ipsclass;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Returns an array of gallery data
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Returns an array of gallery data
|
||||
*
|
||||
* @return array Array of gallery data
|
||||
*/
|
||||
function return_gallery_data( $member_id = 0, $limit = 5, $do_pull = 1 )
|
||||
{
|
||||
if( !$member_id )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Permissions?
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->ipsclass->vars['gallery_guest_access'] AND !$this->ipsclass->member['id'] )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$images = array();
|
||||
|
||||
$member_id = intval($member_id);
|
||||
|
||||
|
||||
$categories = $this->glib->get_allowed_cats( 0 );
|
||||
$albums = $this->glib->get_allowed_albums();
|
||||
|
||||
if( !count($categories) AND !count($albums) )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$where = array();
|
||||
$where_statement = "";
|
||||
|
||||
if( count($categories) )
|
||||
{
|
||||
$where[] = "i.category_id IN (".implode( ',', $categories ).")";
|
||||
}
|
||||
|
||||
if( count($albums) )
|
||||
{
|
||||
$where[] = "i.album_id IN (".implode( ",", $albums ).")";
|
||||
}
|
||||
|
||||
if( !count($where) )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_statement = implode( " OR ", $where );
|
||||
}
|
||||
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'i.*',
|
||||
'from' => array( 'gallery_images' => 'i' ),
|
||||
'where' => "i.member_id={$member_id} AND ({$where_statement})",
|
||||
'add_join' => array(
|
||||
1 => array( 'type' => 'left',
|
||||
'select' => 'a.name as album_name, a.public_album',
|
||||
'from' => array( 'gallery_albums' => 'a' ),
|
||||
'where' => 'a.id=i.album_id',
|
||||
),
|
||||
2 => array( 'type' => 'left',
|
||||
'select' => 'c.name as category_name',
|
||||
'from' => array( 'gallery_categories' => 'c' ),
|
||||
'where' => "c.id=i.category_id",
|
||||
),
|
||||
3 => array( 'type' => 'left',
|
||||
'select' => 'm.members_display_name as name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=i.member_id",
|
||||
),
|
||||
4 => array( 'type' => 'left',
|
||||
'select' => 'r.id as rated, r.rate as _my_rate',
|
||||
'from' => array( 'gallery_ratings' => 'r' ),
|
||||
'where' => "r.img_id=i.id AND r.member_id={$this->ipsclass->member['id']}",
|
||||
)
|
||||
),
|
||||
'order' => 'i.idate DESC',
|
||||
'limit' => array( 0, $limit )
|
||||
) );
|
||||
|
||||
$this->res = $this->ipsclass->DB->exec_query();
|
||||
|
||||
$this->total = $this->ipsclass->DB->get_num_rows( $this->res );
|
||||
//print_r($this->ipsclass->DB);
|
||||
|
||||
if( $do_pull )
|
||||
{
|
||||
while( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$images[] = $r;
|
||||
}
|
||||
|
||||
return $images;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,193 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
|
||||
| > $Revision: 23 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > API: IDM last 5 submissions
|
||||
| > Module written by Brandon Farber
|
||||
| > Date started: Thursday 7/27/2006
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* API: IDM
|
||||
*
|
||||
* EXAMPLE USAGE
|
||||
* <code>
|
||||
* To follow
|
||||
* </code>
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IPS_API_PATH' ) )
|
||||
{
|
||||
/**
|
||||
* Define classes path
|
||||
*/
|
||||
define( 'IPS_API_PATH', dirname(__FILE__) ? dirname(__FILE__) : '.' );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'api_core' ) )
|
||||
{
|
||||
require_once( IPS_API_PATH.'/api_core.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* API: IDM
|
||||
*
|
||||
* This class will pull the last 5 IDM submissions a user has submitted
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @subpackage APIs
|
||||
* @author Brandon Farber
|
||||
* @version 2.1
|
||||
* @since 2.2.0
|
||||
*/
|
||||
class api_idm extends api_core
|
||||
{
|
||||
/**
|
||||
* IPS Class Object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
//var $ipsclass;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Returns an array of download data
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Returns an array of download data
|
||||
*
|
||||
* @return array Array of download data
|
||||
*/
|
||||
function return_idm_data( $member_id = 0, $limit = 5 )
|
||||
{
|
||||
if( !$member_id )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Permissions?
|
||||
//-----------------------------------------
|
||||
|
||||
if( !isset($this->ipsclass->vars['idm_online']) )
|
||||
{
|
||||
// IDM is not installed since the key doesn't exist
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
if( $this->ipsclass->vars['idm_online'] == 0 )
|
||||
{
|
||||
$offline_access = explode( ",", $this->ipsclass->vars['idm_offline_groups'] );
|
||||
|
||||
$my_groups = array( $this->ipsclass->member['mgroup'] );
|
||||
|
||||
if( $this->ipsclass->member['mgroups_other'] )
|
||||
{
|
||||
$my_groups = array_merge( $my_groups, explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroups_other'] ) ) );
|
||||
}
|
||||
|
||||
$continue = 0;
|
||||
|
||||
foreach( $my_groups as $group_id )
|
||||
{
|
||||
if( in_array( $group_id, $offline_access ) )
|
||||
{
|
||||
$continue = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( $continue == 0 )
|
||||
{
|
||||
// Offline, and we don't have access
|
||||
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$files = array();
|
||||
|
||||
$member_id = intval($member_id);
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab allowed categories
|
||||
//-----------------------------------------
|
||||
|
||||
if( !file_exists( ROOT_PATH.'modules/downloads/lib/lib_cats.php' ) )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
require ( ROOT_PATH.'modules/downloads/lib/lib_cats.php' );
|
||||
$this->catlib = new lib_cats();
|
||||
$this->catlib->ipsclass = & $this->ipsclass;
|
||||
$this->catlib->normal_init();
|
||||
$this->catlib->get_member_cat_perms( );
|
||||
|
||||
$categories = $this->catlib->member_access['view'];
|
||||
|
||||
if( !is_array($categories) OR !count($categories) )
|
||||
{
|
||||
//No category permissions
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'f.*',
|
||||
'from' => array( 'downloads_files' => 'f' ),
|
||||
'where' => 'f.file_submitter='.$member_id.' AND f.file_open=1 AND f.file_cat IN ('.implode( ',', $categories ).')',
|
||||
'add_join' => array(
|
||||
1 => array( 'type' => 'left',
|
||||
'select' => 'c.cname as category_name',
|
||||
'from' => array( 'downloads_categories' => 'c' ),
|
||||
'where' => "c.cid=f.file_cat",
|
||||
)
|
||||
),
|
||||
'order' => 'f.file_submitted DESC',
|
||||
'limit' => array( 0, $limit )
|
||||
) );
|
||||
|
||||
$res = $this->ipsclass->DB->exec_query();
|
||||
|
||||
while( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$files[] = $r;
|
||||
}
|
||||
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<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>Ïîæàëóéñòà íàæìèòå íà êíîïî÷êó «<b>Íàçàä</b>» â âàøåì áðàóçåðå äëÿ âîçâðàùåíèÿ íà ïðåäûäóùóþ ñòðàíèöó.</font>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user