Version 2.2.0 RC-1

This commit is contained in:
Neo committed 2025-12-19 00:22:37 -08:00
1 parent f73f8bff6d
commit 22f1b963ee
1034 files changed
+178610 -70897

No files matched your search

+165 -74
View File
@@ -2,27 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-14 18:52:45 +0100 (Fri, 14 Oct 2005) $
| > $Revision: 50 $
| > $Date: 2006-10-13 10:24:39 +0100 (Fri, 13 Oct 2006) $
| > $Revision: 635 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
@@ -34,13 +24,19 @@
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class admin_cache_functions
{
var $master_set = 1;
var $messages = array();
var $no_rebuild = 0;
var $template = "";
var $master_set = 1;
var $messages = array();
var $no_rebuild = 0;
var $template = "";
//-----------------------------------------
// Constructor
@@ -52,11 +48,12 @@ class admin_cache_functions
// Get the libraries
//-----------------------------------------
require_once( KERNEL_PATH.'class_template.php' );
require_once( KERNEL_PATH.'class_template_engine.php' );
$this->template = new class_template();
$this->template->root_path = CACHE_PATH;
$this->template->root_path = CACHE_PATH;
$this->template->allow_php_code = intval( IPB_ACP_ALLOW_TEMPLATE_PHP );
}
//============================================================================================================
@@ -113,14 +110,25 @@ class admin_cache_functions
$theids = array();
foreach( $ids as $i => $d )
foreach( $ids as $d )
{
$theids[] = $d['set_skin_set_id'];
}
$this->ipsclass->DB->do_update( 'skin_sets', array( 'set_cache_wrapper' => $wrapper ), 'set_skin_set_id IN ('.implode(',',$theids).') AND set_skin_set_id != 1' );
$this->messages[] = "Îáíîâëåíèå îôîðìëåíèÿ âûïîëíåíî... (id: ".implode(',',$theids).")";
if( is_object($this->ipsclass->cachelib) AND !$this->no_rebuild )
{
$this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id IN ('.implode(',',$theids).') AND set_skin_set_id != 1' ) );
$this->ipsclass->DB->exec_query();
while( $r = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->cachelib->do_put( 'Skin_Store_' . $r['set_skin_set_id'], $r );
}
}
$this->messages[] = "Done wrapper rebuild... (id: ".implode(',',$theids).")";
}
//============================================================================================================
@@ -131,32 +139,56 @@ class admin_cache_functions
// TEMPLATE: Recache and splash
//-----------------------------------------
function _recache_templates( $id, $parent="", $group_only="", $root=1 )
function _recache_templates( $id, $parent="", $group_only="", $root=1, $master_only=0 )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$ids = array( 0 => array( 'id' => $id, 'parent' => $parent ) );
//-----------------------------------------
// Get any children
// Make sure master templates are written
//-----------------------------------------
if ( $id == 1 and IN_DEV )
if ( $id == 1 )
{
$id = -1;
$master_only = 1;
}
$this->ipsclass->DB->simple_construct( array( 'select' => 'set_skin_set_id, set_skin_set_parent', 'from' => 'skin_sets', 'where' => "set_skin_set_parent=$id" ) );
$this->ipsclass->DB->simple_exec();
//-----------------------------------------
// Just doing root?
//-----------------------------------------
while ( $r = $this->ipsclass->DB->fetch_row() )
if ( $master_only )
{
$ids[] = array( 'id' => $r['set_skin_set_id'], 'parent' => $r['set_skin_set_parent'] );
$ids = array( 0 => array( 'id' => 1, 'parent' => -1 ) );
}
if ( $id == -1 and IN_DEV )
else
{
$id = 1;
}
//-----------------------------------------
// Get any children
//-----------------------------------------
if ( $id == 1 and IN_DEV )
{
$id = -1;
}
$this->ipsclass->DB->simple_construct( array( 'select' => 'set_skin_set_id, set_skin_set_parent', 'from' => 'skin_sets', 'where' => "set_skin_set_parent=$id" ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$ids[] = array( 'id' => $r['set_skin_set_id'], 'parent' => $r['set_skin_set_parent'] );
}
if ( $id == -1 and IN_DEV )
{
$id = 1;
}
}
//-----------------------------------------
// SPIN TO WIN!
//-----------------------------------------
@@ -191,13 +223,12 @@ class admin_cache_functions
$out = "class {$group['group_name']}_{$id} {\n\n";
$out .= ' var $ipsclass;'."\n";
//$out .= 'function '. $group['group_name'] .'( $ipsclass )'."\n{\n".'$this->ipsclass = &$ipsclass;'."\n}\n\n";
$templates = $this->_get_templates( $id, $parent, 'groups', $group['group_name'] );
foreach ($templates as $func_name => $data )
{
$out .= $this->template->convert_html_to_php( $data['func_name'], $data['func_data'], $data['section_content'] ) ."\n";
$out .= $this->template->convert_html_to_php( $data['func_name'], $data['func_data'], $data['section_content'], "", "", $master_only ? 0 : 1 ) ."\n";
if ( $data['set_id'] == $id )
{
@@ -242,7 +273,7 @@ class admin_cache_functions
$this->_write_template_to_file( $id, $group['group_name'], $start.$out.$end );
}
$this->messages[] = "HTML øàáëîíû óñïåøíî îáíîâëåíû... (id: $id)";
$this->messages[] = "Done HTML templates rebuild... (id: $id)";
}
}
@@ -290,7 +321,7 @@ class admin_cache_functions
{
if ( ! is_writeable( CACHE_PATH.'cache/skin_cache/cacheid_'.$id.'/'.$group_name.'.php' ) )
{
$this->messages[] = "::cache_id_{$id}/{$group_name}.php not writeable - cannot cache to PHP files";
$this->messages[] = "<span class='rss-feed-invalid'>cache/skin_cache/cacheid_{$id}/{$group_name}.php not writeable - cannot cache to PHP file</span>";
$good_to_go = 0;
}
else
@@ -306,7 +337,7 @@ class admin_cache_functions
}
else
{
$this->messages[] = "::cache_id_{$id} íå çàïèñàí - íåâîçìîæíî ñîçäàâàòü òàì php ôàéëû";
$this->messages[] = "<span class='rss-feed-invalid'>cache/skin_cache/cacheid_{$id} not writeable - cannot cache to PHP file</span>";
}
}
@@ -324,7 +355,7 @@ class admin_cache_functions
$return = 1;
$this->messages[] = "/skin_cache/cacheid_{$id}/{$group_name}.php óñïåøíî çàïèñàí";
$this->messages[] = "Wrote skin_cache/cacheid_{$id}/{$group_name}.php";
}
}
@@ -383,6 +414,8 @@ class admin_cache_functions
if ( $return == 'titles' )
{
$templates[ $r['group_name'] ] = $r;
$this->template_count[ $r['set_id'] ] = isset($this->template_count[ $r['set_id'] ]) ? $this->template_count[ $r['set_id'] ] : array();
$this->template_count[ $r['set_id'] ][ $r['group_name'] ] = isset($this->template_count[ $r['set_id'] ][ $r['group_name'] ]) ? $this->template_count[ $r['set_id'] ][ $r['group_name'] ] : array( 'count' => 0 );
$this->template_count[ $r['set_id'] ][ $r['group_name'] ]['count']++;
}
else if ( $return == 'group' )
@@ -428,14 +461,14 @@ class admin_cache_functions
if ( ! file_exists( $skin_dir ) )
{
$this->messages[] = "Ýòîò ñòèëü óñòàíîâëåí â áåçîïàñíîì ðåæèìå (safe mode) è php ôàéëû êåøà îòñóòñòâóþò, ñîîòâåòñòâåíî íåò íåîáõîäèìîñòè çàïóñêàòü ýòó óòèëèòó äëÿ ýòîãî ñòèëÿ.";
$this->messages[] = "This template set is a safe mode only skin and no PHP skin files exist, there is no need to run this tool on this template set.";
return 0;
}
if ( ! is_readable($skin_dir) )
{
$this->messages[] = "ÎØÈÁÊÀ: Íåâîçìîæíà çàïèñü â ïàïêó /$skin_dir/, ïîæàëóéñòà, ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) &#151; îíè äîëæíû áûòü 0777!";
$this->messages[] = "FAILD: Cannot write into '$skin_dir', please check the CHMOD value, and if needed, CHMOD to 0777 via FTP. IBF cannot do this for you.";
return 0;
}
@@ -455,7 +488,7 @@ class admin_cache_functions
# Ignore bugtracker
if ( $name == 'skin_bugtracker' )
{
$this->messages[] = "Ïðîïóùåí skin_bugtracker.php...";
$this->messages[] = "Skipping skin_bugtracker.php...";
continue;
}
@@ -466,7 +499,7 @@ class admin_cache_functions
}
else
{
$this->messages[] = "Íåâîçìîæíî îòêðûòü äëÿ ÷òåíèÿ ôàéë $filename, ýòîò ôàéë ïðîïóùåí...";
$this->messages[] = "Could not open $filename for reading, skipping file...";
continue;
}
@@ -475,7 +508,7 @@ class admin_cache_functions
if ( ! preg_match( "/\n/", $fdata ) )
{
$this->messages[] = "Ôàéë $filename ïóñòîé, ýòîò ôàéë ïðîïóùåí...";
$this->messages[] = "Could not find any line endings in $filename, skipping file...";
continue;
}
@@ -491,16 +524,22 @@ class admin_cache_functions
// Skip javascript functions...
//-----------------------------------------
#print htmlspecialchars( $f )."<br />";
if ( preg_match( "/<script/i", $f ) )
{
$script_token = 1;
$script_jump = 0;
#print "<span style='color:purple'>In script...</span><br />";
}
if ( preg_match( "/<\/script>/i", $f ) )
{
$script_token = 0;
$script_jump = 0;
#print "<span style='color:purple'>OUT script...</span><br />";
}
//-----------------------------------------
@@ -514,6 +553,14 @@ class admin_cache_functions
$script_jump = 1;
$script_token = 0;
}
if ( preg_match( "#<if=[\'\"]#", $f ) )
{
$script_jump = 1;
$script_token = 0;
#print "<span style='color:green'>IF found...[ Jump: $script_jump / Token: $script_token ]</span<br />";
}
}
if ( $script_token == 0 AND $script_jump == 1 )
@@ -523,19 +570,29 @@ class admin_cache_functions
$script_jump = 0;
$script_token = 1;
}
if ( preg_match( "#</if>#", $f ) )
{
$script_jump = 0;
$script_token = 1;
#print "<span style='color:green'>/IF found...[ Jump: $script_jump / Token: $script_token ]</span><br />";
}
}
//-----------------------------------------
// NOT IN JS
//-----------------------------------------
if ($script_token == 0)
if ( ! $script_token )
{
if ( preg_match( "/^function\s*([\w\_]+)\s*\((.*)\)/i", $f, $matches ) )
{
$functions[$matches[1]] = '';
$config[$matches[1]] = $matches[2];
$flag = $matches[1];
#print "---<b>".$matches[1]."</b> [ Jump: $script_jump / Token: $script_token ]<br />";
$functions[ $matches[1] ] = '';
$config[ $matches[1] ] = $matches[2];
$flag = $matches[1];
continue;
}
}
@@ -545,7 +602,7 @@ class admin_cache_functions
else
{
// Make JS safe (UBE - Ugly, but effective)
$f = preg_replace( "#if\s+?\(#is" , "i~f~(~" , $f );
$f = preg_replace( "#else#is" , "e~lse~" , $f );
$f = preg_replace( "#else\s+?if#is", "e~lse~i~f", $f );
@@ -607,17 +664,17 @@ class admin_cache_functions
}
else
{
$this->messages[] = "Íåâîçìîæíî îòêðûòü äëÿ ÷òåíèÿ ïàïêó /$skin_dir/.";
$this->messages[] = "Could not open directory $skin_dir for reading!.";
return 0;
}
}
else
{
$this->messages[] = "Íåò ïàïêè $skin_dir &#151; ïîæàëóéñòà, ïðîâåðüòå ïåðåìåííóþ \$root_path â ôàéëå admin.php.";
$this->messages[] = "$skin_dir is not a directory, please check the \$root_path variable in admin.php.";
return 0;
}
$this->messages[] = "Îáíîâëåíèå php ôàéëîâ êåøà óñïåøíî çàâåðøåíî.";
$this->messages[] = "Completed database rebuild from PHP cache files.";
return 1;
}
@@ -710,6 +767,17 @@ class admin_cache_functions
$this->ipsclass->DB->do_update( 'skin_sets', array( 'set_cache_css' => $css ), 'set_skin_set_id IN ('.implode(',',$set_ids).') AND set_skin_set_id != 1' );
if ( is_object($this->ipsclass->cachelib) AND ! $this->no_rebuild )
{
$this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id IN ('.implode(',',$set_ids).') AND set_skin_set_id != 1' ) );
$this->ipsclass->DB->exec_query();
while( $r = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->cachelib->do_put( 'Skin_Store_' . $r['set_skin_set_id'], $r );
}
}
//-----------------------------------------
// Update flat-file caches
//-----------------------------------------
@@ -724,7 +792,7 @@ class admin_cache_functions
$start .= "/*------------------------------------------------------------------*/\n\n";
$start .= "/*~START CSS~*/\n\n";
$css = $this->ipsclass->txt_windowstounix($start.$css);
$css = $this->ipsclass->txt_windowstounix( $start . trim( $css ) );
if ( file_exists( CACHE_PATH."style_images" ) )
{
@@ -755,22 +823,22 @@ class admin_cache_functions
@fclose($FH);
@chmod( CACHE_PATH."style_images/css_".$id['set_skin_set_id'].".css", 0777 );
$this->messages[] = "Îáíîâëåíèå ôàéëà êåøà CSS ñòèëåé css_{$id['set_skin_set_id']}...";
$this->messages[] = "Rebuilding css file for css_{$id['set_skin_set_id']}...";
}
else
{
$this->messages[] = "<br /><b>Ôàéë ñ êåøåì css_{$id['set_skin_set_id']} íå îáíîâëåí! Ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) ó /style_images/ è /style_images/css_{$id['set_skin_set_id']}.css!</b>";
$this->messages[] = "<br /><b>Cache file css_{$id['set_skin_set_id']} not updated. Check CHMOD permissions on ./style_images and ./style_images/css_{$id['set_skin_set_id']}.css</b>";
}
}
}
else
{
$this->messages[] = "<b>Ôàéë(û) êåøà íå îáíîâëåí(û). Ïðîâåðüòå ïðàâà äîñòóïà (CHMOD) ó /style_images/ è /style_images/css_{$id['set_skin_set_id']}.css!</b>";
$this->messages[] = "<b>Cache file(s) not updated. Check CHMOD permissions on ./style_images and ./style_images/css_{$id['set_skin_set_id']}.css</b>";
}
}
else
{
$this->messages[] = "<b>Ôàéë(û) êåøà íå îáíîâëåí(û). Ïàïêà /style_images/ íå ñóùåñòâóåò!</b>";
$this->messages[] = "<b>Cache file(s) not updated. style_images folder not present</b>";
}
}
@@ -801,14 +869,29 @@ class admin_cache_functions
$this->ipsclass->DB->manual_addslashes = 1;
$ids_to_update = array();
foreach( $ids as $i )
{
$macros = $this->_get_macros($i['id'], $i['parent'], $root);
$this->messages[] = "Âûïîëíåíî... (Ìàêðîñ: {$i['id']})...";
$this->messages[] = "Done.... (Macro ID: {$i['id']})...";
$this->ipsclass->DB->do_update( 'skin_sets', array( 'set_cache_macro' => $this->ipsclass->DB->add_slashes(serialize($macros)) ), 'set_skin_set_id='.$i['id'] );
$ids_to_update[] = $i['id'];
}
$this->ipsclass->DB->manual_addslashes = 0;
if ( is_object( $this->ipsclass->cachelib ) AND ! $this->no_rebuild )
{
$this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id IN ('.implode(',',$ids_to_update).')' ) );
$this->ipsclass->DB->exec_query();
while( $r = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->cachelib->do_put( 'Skin_Store_' . $r['set_skin_set_id'], $r );
}
}
}
@@ -857,8 +940,8 @@ class admin_cache_functions
{
$this->no_rebuild = 1;
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_sets', 'order' => 'set_skin_set_parent, set_skin_set_id ASC' ) );
$this->ipsclass->DB->simple_exec();
$this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'skin_sets', 'order' => 'set_skin_set_parent, set_skin_set_id ASC' ) );
$this->ipsclass->DB->exec_query();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
@@ -880,23 +963,23 @@ class admin_cache_functions
// Custom Macros
//-----------------------------------------
$this->messages[] = "Îáíîâëåíèå ìàêðîñîâ äëÿ {$skins[$aid]['set_name']}...";
$this->messages[] = "Rebuilding Macros for set {$skins[$aid]['set_name']}...";
$this->_recache_macros($aid, $skins[ $aid ]['set_skin_set_parent']);
//-----------------------------------------
// Custom CSS
//-----------------------------------------
$this->messages[] = "Îáíîâëåíèå CSS-ñòèëåé äëÿ {$skins[$aid]['set_name']}...";
$this->messages[] = "Rebuilding CSS for set {$skins[$aid]['set_name']}...";
$this->_write_css_to_cache( $aid, $skins[ $aid ]['set_skin_set_parent'] );
//-----------------------------------------
// Custom HTML
//-----------------------------------------
$this->messages[] = "Îáíîâëåíèå êåøà HTML øàáëîíîâ äëÿ {$skins[$aid]['set_name']}...";
$this->messages[] = "Rebuilding HTML templates cache for set {$skins[$aid]['set_name']}...";
$this->_recache_templates( $aid, $skins[ $aid ]['set_skin_set_parent'] );
@@ -904,16 +987,27 @@ class admin_cache_functions
// Custom Wrappers
//-----------------------------------------
$this->messages[] = "Îáíîâëåíèå êåøà ãëàâíîãî øàáëîíà ôîðóìà äëÿ {$skins[$aid]['set_name']}...";
$this->messages[] = "Rebuilding wrappers cache for set {$skins[$aid]['set_name']}...";
$this->_recache_wrapper( $aid, $skins[ $aid ]['set_skin_set_parent'] );
}
if( is_object($this->ipsclass->cachelib) )
{
$this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id IN ('.implode(',',$affected).')' ) );
$this->ipsclass->DB->exec_query();
while( $r = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->cachelib->do_put( 'Skin_Store_' . $r['set_skin_set_id'], $r );
}
}
$this->messages[] = "Îáíîâëåíèå óñòàíîâîê ID ñòèëÿ...";
$this->messages[] = "Rebuilding the skin set ID relationship cache...";
$this->_rebuild_skin_id_cache($skins);
return $message;
return TRUE;
}
//-----------------------------------------
@@ -937,10 +1031,7 @@ class admin_cache_functions
foreach( $skins as $row )
{
if ( $row['set_skin_set_parent'] > 1 )
{
$parent = ','.$row['set_skin_set_parent'];
}
$parent = $row['set_skin_set_parent'] > 1 ? ','.$row['set_skin_set_parent'] : '';
$this->ipsclass->cache['skin_id_cache'][ $row['set_skin_set_id'] ] = array( 'set_skin_set_id' => $row['set_skin_set_id'],
'set_tree_list' => $row['set_skin_set_id'].$parent.',1',