Version 2.1.7

This commit is contained in:
Neo committed 2025-12-19 00:21:15 -08:00
1 parent 0eecc172d9
commit f73f8bff6d
941 files changed
+215301 -103093

No files matched your search

+674
View File
@@ -0,0 +1,674 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 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-28 15:18:16 +0100 (Fri, 28 Oct 2005) $
| > $Revision: 67 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > Components Functions
| > Module written by Matt Mecham
| > Date started: 12th April 2005 (13:09)
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
exit();
}
class ad_login_auth
{
# Globals
var $ipsclass;
var $perm_main = 'tools';
var $perm_child = 'loginauth';
/*-------------------------------------------------------------------------*/
// Main handler
/*-------------------------------------------------------------------------*/
function auto_run()
{
$this->html = $this->ipsclass->acp_load_template('cp_skin_tools');
switch($this->ipsclass->input['code'])
{
case 'manage':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
$this->login_list();
break;
case 'login_add':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
$this->login_form('add');
break;
case 'login_add_do':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
$this->login_save('add');
break;
case 'login_edit_details':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
$this->login_form('edit');
break;
case 'login_edit_do':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
$this->login_save('edit');
break;
case 'login_diagnostics':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':diagnostics' );
$this->login_diagnostics();
break;
case 'components_export':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':export' );
$this->components_export('single');
break;
case 'component_import':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':import' );
$this->components_import();
break;
case 'component_move':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
$this->components_move();
break;
default:
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
$this->login_list();
break;
}
}
/*-------------------------------------------------------------------------*/
// Components Rebuild Cache
/*-------------------------------------------------------------------------*/
function components_rebuildcache()
{
$this->ipsclass->cache['components'] = array();
$this->ipsclass->DB->simple_construct( array( 'select' => 'com_id,com_enabled,com_section,com_filename,com_url_uri,com_url_title,com_position', 'from' => 'components', 'order' => 'com_position ASC' ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->cache['components'][] = $r;
}
$this->ipsclass->update_cache( array( 'name' => 'components', 'array' => 1, 'deletefirst' => 1 ) );
}
/*-------------------------------------------------------------------------*/
// Components Import
/*-------------------------------------------------------------------------*/
function components_import()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$updated = 0;
$inserted = 0;
$cur_components = array();
if ( $_FILES['FILE_UPLOAD']['name'] == "" or ! $_FILES['FILE_UPLOAD']['name'] or ($_FILES['FILE_UPLOAD']['name'] == "none") )
{
//-----------------------------------------
// check and load from server
//-----------------------------------------
if ( ! $this->ipsclass->input['file_location'] )
{
$this->ipsclass->main_msg = "Çàãðóæàåìûé ôàéë íå íàéäåí!";
$this->components_list();
return;
}
if ( ! file_exists( ROOT_PATH . $this->ipsclass->input['file_location'] ) )
{
$this->ipsclass->main_msg = "Íåëüçÿ íàéòè ôàéë äëÿ îòêðûòèÿ: " . ROOT_PATH . $this->ipsclass->input['file_location'];
$this->components_list();
return;
}
if ( preg_match( "#\.gz$#", $this->ipsclass->input['file_location'] ) )
{
if ( $FH = @gzopen( ROOT_PATH.$this->ipsclass->input['file_location'], 'rb' ) )
{
while ( ! @gzeof( $FH ) )
{
$content .= @gzread( $FH, 1024 );
}
@gzclose( $FH );
}
}
else
{
if ( $FH = @fopen( ROOT_PATH.$this->ipsclass->input['file_location'], 'rb' ) )
{
$content = @fread( $FH, filesize(ROOT_PATH.$this->ipsclass->input['lang_location']) );
@fclose( $FH );
}
}
}
else
{
//-----------------------------------------
// Get uploaded schtuff
//-----------------------------------------
$tmp_name = $_FILES['FILE_UPLOAD']['name'];
$tmp_name = preg_replace( "#\.gz$#", "", $tmp_name );
$content = $this->ipsclass->admin->import_xml( $tmp_name );
}
//-----------------------------------------
// Get current components.
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => 'com_id, com_section',
'from' => 'components',
'order' => 'com_id' ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$cur_components[ $r['com_section'] ] = $r['com_id'];
}
//-----------------------------------------
// Get xml mah-do-dah
//-----------------------------------------
require( KERNEL_PATH.'class_xml.php' );
$xml = new class_xml();
//-----------------------------------------
// Unpack the datafile
//-----------------------------------------
$xml->xml_parse_document( $content );
//-----------------------------------------
// pArse
//-----------------------------------------
$fields = array( 'com_title' , 'com_description', 'com_author' , 'com_url', 'com_version', 'com_menu_data',
'com_enabled' , 'com_safemode' , 'com_section', 'com_filename' );
if ( ! is_array( $xml->xml_array['componentexport']['componentgroup']['component'][0] ) )
{
//-----------------------------------------
// Ensure [0] is populated
//-----------------------------------------
$tmp = $xml->xml_array['componentexport']['componentgroup']['component'];
unset($xml->xml_array['componentexport']['componentgroup']['component']);
$xml->xml_array['componentexport']['componentgroup']['component'][0] = $tmp;
}
foreach( $xml->xml_array['componentexport']['componentgroup']['component'] as $id => $entry )
{
$newrow = array();
foreach( $fields as $f )
{
$newrow[$f] = $entry[ $f ]['VALUE'];
}
$this->ipsclass->DB->force_data_type = array( 'com_version' => 'string' );
if ( $cur_components[ $entry['com_section']['VALUE'] ] )
{
//-----------------------------------------
// Update
//-----------------------------------------
$this->ipsclass->DB->do_update( 'components', $newrow, 'com_id='.$cur_components[ $entry['com_section']['VALUE'] ] );
$updated++;
}
else
{
//-----------------------------------------
// INSERT
//-----------------------------------------
$newrow['com_date_added'] = time();
$this->ipsclass->DB->do_insert( 'components', $newrow );
$inserted++;
}
}
//-----------------------------------------
// Done...
//-----------------------------------------
$this->components_rebuildcache();
$this->ipsclass->main_msg = "$updated êîìïîíåíòîâ îáíîâëåíî $inserted êîìïîíåíòîâ âñòàâëåíî";
$this->components_list();
}
/*-------------------------------------------------------------------------*/
// Components Export
/*-------------------------------------------------------------------------*/
function components_export($type='single')
{
//--------------------------------------------
// INIT
//--------------------------------------------
$com_id = intval($this->ipsclass->input['com_id']);
$rows = array();
//--------------------------------------------
// Checks...
//--------------------------------------------
if ( $type == 'single' )
{
if ( ! $com_id )
{
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî ";
$this->components_list();
return;
}
//--------------------------------------------
// Get DB row(s)
//--------------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'components', 'where' => 'com_id='.$com_id ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$rows[] = $r;
}
}
else
{
//--------------------------------------------
// Get DB row(s)
//--------------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'components' ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$rows[] = $r;
}
}
//-------------------------------
// Get XML class
//-------------------------------
require_once( KERNEL_PATH.'class_xml.php' );
$xml = new class_xml();
$xml->xml_set_root( 'componentexport', array( 'exported' => time() ) );
//-------------------------------
// Add component
//-------------------------------
$xml->xml_add_group( 'componentgroup' );
$entry = array();
foreach( $rows as $idx => $r )
{
$content = array();
foreach( $r as $k => $v )
{
$content[] = $xml->xml_build_simple_tag( $k, $v );
}
$entry[] = $xml->xml_build_entry( 'component', $content );
}
$xml->xml_add_entry_to_group( 'componentgroup', $entry );
$xml->xml_format_document();
$doc = $xml->xml_document;
//-------------------------------
// Print to browser
//-------------------------------
$this->ipsclass->admin->show_download( $doc, 'ipd_components.xml', '', 0 );
}
/*-------------------------------------------------------------------------*/
// Log in: Diagnostics
/*-------------------------------------------------------------------------*/
function login_diagnostics()
{
//-----------------------------------------
// Init Vars
//-----------------------------------------
$login_id = intval($this->ipsclass->input['login_id']);
//-----------------------------------------
// Check (please?)
//-----------------------------------------
$login = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_id='.$login_id ) );
if ( ! $login['login_id'] )
{
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî.";
$this->login_list();
return;
}
//-----------------------------------------
// Generate file
//-----------------------------------------
$mypath = ROOT_PATH.'sources/loginauth/'.$login['login_folder_name'];
//-----------------------------------------
// Generate General Info
//-----------------------------------------
$login['_enabled_img'] = $login['login_enabled'] ? 'aff_tick.png' : 'aff_cross.png';
$login['_installed_img'] = $login['login_installed'] ? 'aff_tick.png' : 'aff_cross.png';
$login['_has_settings'] = $login['login_settings'] ? 'aff_tick.png' : 'aff_cross.png';
//-----------------------------------------
// File based info
//-----------------------------------------
$login['_file_auth_exists'] = @file_exists( $mypath.'/auth.php' ) ? 'aff_tick.png' : 'aff_cross.png';
$login['_file_conf_exists'] = @file_exists( $mypath.'/conf.php' ) ? 'aff_tick.png' : 'aff_cross.png';
$login['_file_acp_exists'] = @file_exists( $mypath.'/acp.php' ) ? 'aff_tick.png' : 'aff_cross.png';
$login['_file_conf_write'] = @file_exists( $mypath.'/conf.php' ) ? 'aff_tick.png' : 'aff_cross.png';
$this->ipsclass->html .= $this->html->login_diagnostics( $login );
$this->ipsclass->html_help_title = "Óïðàâëåíèå àâòîðèçàöèåé";
$this->ipsclass->html_help_msg = "Ýòà ñåêöèÿ ïîçâîëèò âàì óïðàâëÿòü èäåíòèôèêàöèîííûìè ìåòîäàìè äëÿ âõîäà.";
$this->ipsclass->admin->nav[] = array( "{$this->ipsclass->form_code}", "Óïðàâëåíèå àâòîðèçàöèåé" );
$this->ipsclass->admin->output();
}
/*-------------------------------------------------------------------------*/
// Components Save
/*-------------------------------------------------------------------------*/
function login_save($type='add')
{
//--------------------------------------------
// INIT
//--------------------------------------------
$login_id = intval($this->ipsclass->input['login_id']);
$login_title = trim( $this->ipsclass->input['login_title'] );
$login_description = trim( $this->ipsclass->txt_stripslashes( $this->ipsclass->txt_UNhtmlspecialchars($_POST['login_description'])) );
$login_folder_name = trim( $this->ipsclass->input['login_folder_name'] );
$login_maintain_url = trim( $this->ipsclass->input['login_maintain_url'] );
$login_register_url = trim( $this->ipsclass->input['login_register_url'] );
$login_alt_login_html = trim( $this->ipsclass->txt_stripslashes( $this->ipsclass->txt_UNhtmlspecialchars($_POST['login_alt_login_html'])) );
$login_type = trim( $this->ipsclass->input['login_type'] );
$login_enabled = intval($this->ipsclass->input['login_enabled']);
$login_settings = intval($this->ipsclass->input['login_settings']);
$login_replace_form = intval($this->ipsclass->input['login_replace_form']);
$login_installed = intval($this->ipsclass->input['login_installed']);
$login_safemode = intval($this->ipsclass->input['login_safemode']);
$login_allow_create = intval($this->ipsclass->input['login_allow_create']);
//--------------------------------------------
// Checks...
//--------------------------------------------
if ( $type == 'edit' )
{
if ( ! $login_id )
{
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî ";
$this->login_list();
return;
}
//--------------------------------------------
// Enabled this one?
//--------------------------------------------
if ( $login_enabled )
{
$this->ipsclass->DB->do_update( 'login_methods', array( 'login_enabled' => 0 ) );
}
}
if ( ! $login_title OR ! $login_folder_name OR ! $login_folder_name )
{
$this->ipsclass->main_msg = "Âû äîëæíû çàïîëíèòü âñå ïîëÿ";
$this->login_form( $type );
return;
}
//--------------------------------------------
// Save...
//--------------------------------------------
$array = array( 'login_title' => $login_title,
'login_description' => $login_description,
'login_folder_name' => $login_folder_name,
'login_maintain_url' => $login_maintain_url,
'login_register_url' => $login_register_url,
'login_alt_login_html' => $login_alt_login_html,
'login_type' => $login_type,
'login_enabled' => $login_enabled,
'login_settings' => $login_settings,
'login_replace_form' => $login_replace_form,
'login_allow_create' => $login_allow_create
);
//--------------------------------------------
// In DEV?
//--------------------------------------------
if ( IN_DEV )
{
$array['login_installed'] = $login_installed;
$array['login_safemode'] = $login_safemode;
}
//--------------------------------------------
// Nike.. do it
//--------------------------------------------
if ( $type == 'add' )
{
$array['login_date'] = time();
$this->ipsclass->DB->do_insert( 'login_methods', $array );
$this->ipsclass->main_msg = 'Íîâûé ìåòîä âõîäà áûë äîáàâëåí';
}
else
{
$this->ipsclass->DB->do_update( 'login_methods', $array, 'login_id='.$login_id );
$this->ipsclass->main_msg = 'Íîâûé ìåòîä âõîäà áûë èçìåíåí';
}
$this->login_list();
}
/*-------------------------------------------------------------------------*/
// Log in: Form
/*-------------------------------------------------------------------------*/
function login_form( $type='add' )
{
//-----------------------------------------
// Init Vars
//-----------------------------------------
$login_id = intval($this->ipsclass->input['login_id']);
$login_dd = array( 0 => array( 'passthrough', 'Pass-Through' ), 1 => array( 'onfail', 'On-Fail' ) );
//-----------------------------------------
// Check (please?)
//-----------------------------------------
if ( $type == 'add' )
{
$formcode = 'login_add_do';
$title = "Ñîçäàíèÿ íîâîãî ìåòîäà âõîäà";
$button = "Ñîçäàòü";
}
else
{
$login = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_id='.$login_id ) );
if ( ! $login['login_id'] )
{
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî.";
$this->login_list();
return;
}
$formcode = 'login_edit_do';
$title = "Ðåäàêòèðîâàíèå: ".$login['login_title'];
$button = "Ñîõðàíèòü èçìåíåíèÿ";
}
//-------------------------------
// Form elements
//-------------------------------
$form = array();
$form['login_title'] = $this->ipsclass->adskin->form_input( 'login_title' , $_POST['login_title'] ? $_POST['login_title'] : $login['login_title'] );
$form['login_description'] = $this->ipsclass->adskin->form_input( 'login_description' , $this->ipsclass->txt_htmlspecialchars( $_POST['login_description'] ? $_POST['login_description'] : $login['login_description'] ) );
$form['login_folder_name'] = $this->ipsclass->adskin->form_input( 'login_folder_name' , $_POST['login_folder_name'] ? $_POST['login_folder_name'] : $login['login_folder_name'] );
$form['login_maintain_url'] = $this->ipsclass->adskin->form_input( 'login_maintain_url' , $_POST['login_maintain_url'] ? $_POST['login_maintain_url'] : $login['login_maintain_url'] );
$form['login_register_url'] = $this->ipsclass->adskin->form_input( 'login_register_url' , $_POST['login_register_url'] ? $_POST['login_register_url'] : $login['login_register_url'] );
$form['login_alt_login_html'] = $this->ipsclass->adskin->form_textarea( 'login_alt_login_html', $this->ipsclass->txt_htmlspecialchars( $_POST['login_alt_login_html'] ? $_POST['login_alt_login_html'] : $login['login_alt_login_html'] ) );
$form['login_enabled'] = $this->ipsclass->adskin->form_yes_no( 'login_enabled' , $_POST['login_enabled'] ? $_POST['login_enabled'] : $login['login_enabled'] );
$form['login_settings'] = $this->ipsclass->adskin->form_yes_no( 'login_settings' , $_POST['login_settings'] ? $_POST['login_settings'] : $login['login_settings'] );
$form['login_replace_form'] = $this->ipsclass->adskin->form_yes_no( 'login_replace_form' , $_POST['login_replace_form'] ? $_POST['login_replace_form'] : $login['login_replace_form'] );
$form['login_type'] = $this->ipsclass->adskin->form_dropdown( 'login_type' , $login_dd, $_POST['login_type'] ? $_POST['login_type'] : $login['login_type'] );
$form['login_allow_create'] = $this->ipsclass->adskin->form_yes_no( 'login_allow_create' , $_POST['login_allow_create'] ? $_POST['login_allow_create'] : $login['login_allow_create'] );
if ( IN_DEV )
{
$form['login_safemode'] = $this->ipsclass->adskin->form_yes_no( 'login_safemode' , $_POST['login_safemode'] ? $_POST['login_safemode'] : $login['login_safemode'] );
$form['login_installed'] = $this->ipsclass->adskin->form_yes_no( 'login_installed', $_POST['login_installed'] ? $_POST['login_installed']: $login['login_installed'] );
}
$this->ipsclass->html .= $this->html->login_form( $form, $title, $formcode, $button, $login );
$this->ipsclass->html_help_title = "Óïðàâëåíèå àâòîðèçàöèåé";
$this->ipsclass->html_help_msg = "Ýòà ñåêöèÿ ïîçâîëèò âàì óïðàâëÿòü èäåíòèôèêàöèîííûìè ìåòîäàìè äëÿ àâòîðèçàöèè.";
$this->ipsclass->admin->nav[] = array( "{$this->ipsclass->form_code}", "Óïðàâëåíèå àâòîðèçàöèåé" );
$this->ipsclass->admin->output();
}
/*-------------------------------------------------------------------------*/
// List current log in types
/*-------------------------------------------------------------------------*/
function login_list()
{
$this->ipsclass->admin->nav[] = array( $this->ipsclass->form_code, 'Óïðàâëåíèå âõîäîì èäåíòèôèêàöèè' );
//-------------------------------
// INIT
//-------------------------------
$content = "";
//-------------------------------
// Get components
//-------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'login_methods', 'order' => 'login_title ASC' ) );
$this->ipsclass->DB->simple_exec();
while( $r = $this->ipsclass->DB->fetch_row() )
{
//-------------------------------
// Until IPB 3.0: hardcode some stuff
//-------------------------------
$r['login_installed'] = 1;
//-------------------------------
// (Alex) Cross
//-------------------------------
$r['_enabled_img'] = $r['login_enabled'] ? 'aff_tick.png' : 'aff_cross.png';
$r['_installed_img'] = $r['login_installed'] ? 'aff_tick.png' : 'aff_cross.png';
$content .= $this->html->login_row($r);
}
$this->ipsclass->html .= $this->html->login_overview( $content );
$this->ipsclass->admin->page_title = "Óïðàâëåíèå âõîäîì èäåíòèôèêàöèè";
$this->ipsclass->admin->page_detail = "Ýòà ñåêöèÿ ïîçâîëèò âàì óïðàâëÿòü ìåòîäàìè âõîäà.";
$this->ipsclass->admin->output();
}
}
?>