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

+160 -23
View File
@@ -1,26 +1,17 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| =============================================
+---------------------------------------------------------------------------
| Invision Power Board
| ========================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2004 Invision Power Services
| 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 IS NOT FREE SOFTWARE!
| http://www.invisionboard.com
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+--------------------------------------------------------------------------
|
| > File Management Functions
| > Script written by Matt Mecham
@@ -72,6 +63,14 @@ class class_file_management
*/
var $errors = array();
/**
* HTTP Status Code/Text
*
* @var array
*/
var $http_status_code = 0;
var $http_status_text = "";
/**#@+
* Set Authentication
*
@@ -120,7 +119,7 @@ class class_file_management
return FALSE;
}
if ( ! stristr( $file_location, 'http://' ) )
if ( ! stristr( $file_location, 'http://' ) AND ! stristr( $file_location, 'https://' ) )
{
//-------------------------------
// It's a path!
@@ -128,7 +127,7 @@ class class_file_management
if ( ! file_exists( $file_location ) )
{
$this->errors[] = "Ôàéë '$file_location' íå ñóùåñòâóåò, ïîæàëóéñòà ïðîâåðüòå íàñòðîéêè ññûëêè íà øàáëîíû.";
$this->errors[] = "File '$file_location' does not exist, please check the path.";
return;
}
@@ -246,34 +245,38 @@ class class_file_management
if ( ! $fp = @fsockopen( $host, $port, $errno, $errstr, $fsocket_timeout ) )
{
$this->errors[] = "CONNECTION REFUSED FROM $host";
$this->errors[] = "Could not establish a connection with $host";
return FALSE;
}
else
{
$final_carriage = "";
if( ! $this->auth_req )
{
$final_carriage = "\r\n";
}
if ( ! fputs( $fp, "GET $path HTTP/1.0\r\nHost:$host\r\nConnection: Keep-Alive\r\n{$final_carriage}" ) )
{
$this->errors[] = "Unable to send request to $host!";
return FALSE;
}
if( $this->auth_req )
if ( $this->auth_req )
{
if( $this->auth_user && $this->auth_pass )
if ( $this->auth_user && $this->auth_pass )
{
$header = "Authorization: Basic ".base64_encode("{$this->auth_user}:{$this->auth_pass}")."\r\n\r\n";
if ( ! fputs( $fp, $header ) )
{
$this->errors[] = "Authorization Failed!";
return FALSE;
}
}
}
}
}
@stream_set_timeout($fp, $fsocket_timeout);
@@ -292,6 +295,10 @@ class class_file_management
// Strip headers
//-------------------------------
// HTTP/1.1 ### ABCD
$this->http_status_code = substr( $data, 9, 3 );
$this->http_status_text = substr( $data, 13, ( strpos( $data, "\r\n" ) - 13 ) );
$tmp = split("\r\n\r\n", $data, 2);
$data = $tmp[1];
@@ -309,7 +316,7 @@ class class_file_management
*/
function get_contents_with_curl( $file_location )
{
if ( function_exists( 'curl_init' ) )
if ( function_exists( 'curl_init' ) AND function_exists("curl_exec") )
{
$ch = curl_init( $file_location );
@@ -329,6 +336,136 @@ class class_file_management
}
}
/*-------------------------------------------------------------------------*/
// dir_copy_dir
//
// Copies to contents of a dir to a new dir, creating
// destination dir if needed.
//
/*-------------------------------------------------------------------------*/
function dir_copy_dir($from_path, $to_path, $mode = 0777)
{
$this->errors = "";
//-----------------------------------------
// Strip off trailing slashes...
//-----------------------------------------
$from_path = preg_replace( "#/$#", "", $from_path);
$to_path = preg_replace( "#/$#", "", $to_path);
if ( ! is_dir( $from_path ) )
{
$this->errors[] = "Could not locate directory '$from_path'";
return FALSE;
}
if ( ! is_dir( $to_path ) )
{
if ( ! @mkdir( $to_path, $mode ) )
{
$this->errors[] = "Could not create directory '$to_path' please check the CHMOD permissions and re-try";
return FALSE;
}
else
{
@chmod( $to_path, $mode );
}
}
if ( is_dir( $from_path ) )
{
$handle = opendir($from_path);
while ( ($file = readdir($handle)) !== false )
{
if ( ($file != ".") && ($file != "..") )
{
if ( is_dir( $from_path."/".$file ) )
{
$this->dir_copy_dir($from_path."/".$file, $to_path."/".$file);
}
if ( is_file( $from_path."/".$file ) )
{
copy($from_path."/".$file, $to_path."/".$file);
@chmod($to_path."/".$file, 0777);
}
}
}
closedir($handle);
}
if ( ! count( $this->errors ) )
{
return TRUE;
}
}
/*-------------------------------------------------------------------------*/
// dir_rm_dir
//
// Removes directories, if non empty, removes
// content and directories
/*-------------------------------------------------------------------------*/
function dir_rm_dir($file)
{
$errors = 0;
//-----------------------------------------
// Remove trailing slashes..
//-----------------------------------------
$file = preg_replace( "#/$#", "", $file );
if ( file_exists($file) )
{
//-----------------------------------------
// Attempt CHMOD
//-----------------------------------------
@chmod($file, 0777);
if ( is_dir($file) )
{
$handle = opendir($file);
while ( ($filename = readdir($handle)) !== false )
{
if ( ($filename != ".") && ($filename != "..") )
{
$this->dir_rm_dir($file."/".$filename);
}
}
closedir($handle);
if ( ! @rmdir($file) )
{
$errors++;
}
}
else
{
if ( ! @unlink($file) )
{
$errors++;
}
}
}
if ($errors == 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
}
?>