Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Control Panel Functions
|
||||
* Last Updated: $Date: 2010-09-15 19:24:12 -0400 (Wed, 15 Sep 2010) $
|
||||
* Last Updated: $Date: 2011-09-13 21:55:41 -0400 (Tue, 13 Sep 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @link http://hatynka.in
|
||||
* @since Tue. 17th August 2004
|
||||
* @version $Rev: 6882 $
|
||||
* @version $Rev: 9487 $
|
||||
*
|
||||
*/
|
||||
class adminFunctions
|
||||
@@ -30,6 +30,9 @@ class adminFunctions
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
@@ -47,7 +50,7 @@ class adminFunctions
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
@@ -64,16 +67,15 @@ class adminFunctions
|
||||
|
||||
$this->registry->output->global_template = $this->registry->output->loadRootTemplate('cp_skin_global');
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'admin_global' ) );
|
||||
|
||||
//------------------------------------------
|
||||
// Message in a bottle?
|
||||
//------------------------------------------
|
||||
|
||||
if( isset($this->request['messageinabottleacp']) AND $this->request['messageinabottleacp'] )
|
||||
if( !empty($this->request['messageinabottleacp']) )
|
||||
{
|
||||
$this->request['messageinabottleacp'] = IPSText::getTextClass('bbcode')->xssHtmlClean( IPSText::UNhtmlspecialchars( urldecode( $this->request['messageinabottleacp'] ) ) );
|
||||
$this->registry->output->global_message = $this->request['messageinabottleacp'];
|
||||
$this->request['messageinabottleacp'] = IPSText::getTextClass('bbcode')->xssHtmlClean( IPSText::UNhtmlspecialchars( urldecode( $this->request['messageinabottleacp'] ) ) );
|
||||
$this->registry->output->global_message = $this->request['messageinabottleacp'];
|
||||
$this->registry->output->persistent_message = intval($this->request['messagepersistent']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,15 +149,14 @@ class adminFunctions
|
||||
|
||||
$id = ( $id ) ? $id : $this->memberData['member_id'];
|
||||
|
||||
$_test = $this->DB->buildAndFetch( array(
|
||||
'select' => 'sys_login_id, sys_cookie',
|
||||
'from' => 'core_sys_login',
|
||||
'where' => 'sys_login_id=' . intval( $id )
|
||||
) );
|
||||
$_test = $this->DB->buildAndFetch( array( 'select' => 'sys_login_id, sys_cookie',
|
||||
'from' => 'core_sys_login',
|
||||
'where' => 'sys_login_id=' . intval( $id )
|
||||
) );
|
||||
|
||||
$cookie = ( $_test['sys_cookie'] ) ? unserialize( $_test['sys_cookie'] ) : array();
|
||||
$cookie[ $key ] = $data;
|
||||
|
||||
|
||||
if ( $_test['sys_login_id'] )
|
||||
{
|
||||
$this->DB->update( 'core_sys_login', array( 'sys_cookie' => serialize( $cookie ) ), 'sys_login_id=' . intval( $id ) );
|
||||
@@ -174,13 +175,20 @@ class adminFunctions
|
||||
* @access public
|
||||
* @return string MD5 secure hash
|
||||
* @see getSecurityKey()
|
||||
**/
|
||||
*/
|
||||
public function generateSecureHash()
|
||||
{
|
||||
/* Generate Secure Hash */
|
||||
$ip_octets = explode( ".", $this->member->ip_address );
|
||||
$key = md5( ( isset($this->memberData['joined']) ? $this->memberData['joined'] : 0 ) . "(&)" . $ip_octets[0] . '(&)' . $ip_octets[1] . '(&)' . ( isset($this->memberData['member_login_key']) ? $this->memberData['member_login_key'] : 0 ) );
|
||||
|
||||
if ( IPB_ACP_IP_MATCH )
|
||||
{
|
||||
$ip_octets = explode( ".", $this->member->ip_address );
|
||||
$key = md5( ( isset($this->memberData['joined']) ? $this->memberData['joined'] : 0 ) . "(&)" . $ip_octets[0] . '(&)' . $ip_octets[1] . '(&)' . ( isset($this->memberData['member_login_key']) ? $this->memberData['member_login_key'] : 0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = md5( ( isset($this->memberData['joined']) ? $this->memberData['joined'] : 0 ) . '(&)' . ( isset($this->memberData['member_login_key']) ? $this->memberData['member_login_key'] : 0 ) );
|
||||
}
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
@@ -191,10 +199,17 @@ class adminFunctions
|
||||
* @return string MD5 secure hash
|
||||
* @see checkSecurityKey()
|
||||
* @see getSecurityKey()
|
||||
**/
|
||||
*/
|
||||
public function getSecurityKey()
|
||||
{
|
||||
return md5( ( isset($this->memberData['email']) ? $this->memberData['email'] : 0 ) . '^' . ( isset($this->memberData['joined']) ? $this->memberData['joined'] : 0 ) . '^' . $this->member->ip_address . md5( $this->settings['sql_pass'] ) );
|
||||
if ( IPB_ACP_IP_MATCH )
|
||||
{
|
||||
return md5( ( isset($this->memberData['email']) ? $this->memberData['email'] : 0 ) . '^' . ( isset($this->memberData['joined']) ? $this->memberData['joined'] : 0 ) . '^' . $this->member->ip_address . md5( $this->settings['sql_pass'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return md5( ( isset($this->memberData['email']) ? $this->memberData['email'] : 0 ) . '^' . ( isset($this->memberData['joined']) ? $this->memberData['joined'] : 0 ) . '^' . md5( $this->settings['sql_pass'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,17 +250,15 @@ class adminFunctions
|
||||
*/
|
||||
public function saveAdminLog( $action="" )
|
||||
{
|
||||
$this->DB->insert( 'admin_logs', array(
|
||||
'appcomponent' => $this->request['app'],
|
||||
'module' => $this->request['module'],
|
||||
'section' => $this->request['section'],
|
||||
'do' => $this->request['do'],
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'ctime' => time(),
|
||||
'note' => $action,
|
||||
'ip_address' => $this->member->ip_address,
|
||||
)
|
||||
);
|
||||
$this->DB->insert( 'admin_logs', array( 'appcomponent' => $this->request['app'],
|
||||
'module' => $this->request['module'],
|
||||
'section' => $this->request['section'],
|
||||
'do' => $this->request['do'],
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'ctime' => time(),
|
||||
'note' => $action,
|
||||
'ip_address' => $this->member->ip_address,
|
||||
) );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -257,6 +270,8 @@ class adminFunctions
|
||||
* @access public
|
||||
* @param string File location
|
||||
* @return string XML contents
|
||||
* @note This function is not restricted to XML. It will return the contents of the uploaded file regardless of file type.
|
||||
* @todo [Future] We should rename this function to something more generic. It is not restricted to 'xml' so the name is misleading.
|
||||
*/
|
||||
public function importXml( $location='' )
|
||||
{
|
||||
@@ -285,7 +300,7 @@ class adminFunctions
|
||||
}
|
||||
|
||||
/* Now load it... $location could have been set by the upload check...*/
|
||||
if ( file_exists( $location ) )
|
||||
if ( is_file( $location ) )
|
||||
{
|
||||
if ( substr( $location, -3 ) == '.gz' )
|
||||
{
|
||||
@@ -299,153 +314,18 @@ class adminFunctions
|
||||
@gzclose( $FH );
|
||||
}
|
||||
}
|
||||
else if ( substr( $location, -4 ) == '.xml' )
|
||||
else //if ( substr( $location, -4 ) == '.xml' )
|
||||
{
|
||||
$content = file_get_contents( $location );
|
||||
}
|
||||
}
|
||||
|
||||
/* Unlink the tmp file if it exists */
|
||||
if ( file_exists( $UPLOAD_DIR . "/" . $FILE_NAME ) )
|
||||
if ( is_file( $UPLOAD_DIR . "/" . $FILE_NAME ) )
|
||||
{
|
||||
@unlink( $UPLOAD_DIR . "/" . $FILE_NAME );
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a directory
|
||||
*
|
||||
* @access public
|
||||
* @param string From path
|
||||
* @param string To path
|
||||
* @param integer Octal permissions value
|
||||
* @return boolean
|
||||
* @see classFileManagement::copyDirectory()
|
||||
* @deprecated With the presence of the kernel class, we should deprecate the usage of this method
|
||||
*/
|
||||
public function copyDirectory($from_path, $to_path, $mode = 0777)
|
||||
{
|
||||
$this->errors = "";
|
||||
|
||||
//-----------------------------------------
|
||||
// Strip off trailing slashes...
|
||||
//-----------------------------------------
|
||||
|
||||
$from_path = rtrim( $from_path, '/' );
|
||||
$to_path = rtrim( $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->copyDirectory($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 ($this->errors == "")
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a directory (and all of its contents)
|
||||
*
|
||||
* @access public
|
||||
* @param string Directory or filename
|
||||
* @return boolean
|
||||
* @see classFileManagement::removeDirectory()
|
||||
* @deprecated With the presence of the kernel class, we should deprecate the usage of this method
|
||||
*/
|
||||
public function removeDirectory($file)
|
||||
{
|
||||
$errors = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove trailing slashes..
|
||||
//-----------------------------------------
|
||||
|
||||
$file = rtrim( $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->removeDirectory($file."/".$filename);
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
|
||||
if ( ! @rmdir($file) )
|
||||
{
|
||||
$errors++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! @unlink($file) )
|
||||
{
|
||||
$errors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user