Version 3.0.5
This commit is contained in:
1 parent
19b38c7c74
commit
1d4720f3e2
3755 files changed
+508378
-664541
No files matched your search
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+---------------------------------------------------------------------------
|
||||
| IP.Board v3.4.5
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2008 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
+---------------------------------------------------------------------------
|
||||
| Invision Power Board IS NOT FREE SOFTWARE!
|
||||
+---------------------------------------------------------------------------
|
||||
| http://www.invisionpower.com/
|
||||
| > $Id: 10039 2011-12-20 19:49:28Z mmecham $
|
||||
| > $Revision: 10039 $
|
||||
| > $Date: 2011-12-20 14:49:28 -0500 (Tue, 20 Dec 2011) $
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
@set_time_limit( 3600 );
|
||||
|
||||
/**
|
||||
* Main public executable wrapper.
|
||||
*
|
||||
* Set-up and load module to run
|
||||
*
|
||||
* @package IP.Board
|
||||
* @author Matt Mecham
|
||||
* @version 3.0
|
||||
*/
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
elseif ( is_file( '../initdata.php' ) )
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( 'initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
private $processed = 0;
|
||||
private $parser;
|
||||
private $oldparser;
|
||||
private $start = 0;
|
||||
private $end = 0;
|
||||
|
||||
const TOPICS_PER_GO = 100;
|
||||
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->memberData = array();
|
||||
|
||||
/* Do we have a remote DB? */
|
||||
if ( $this->settings['archive_remote_sql_database'] && $this->settings['archive_remote_sql_user'] )
|
||||
{
|
||||
if ( ! is_object( $this->registry->dbFunctions()->getDB('remoteArchive') ) )
|
||||
{
|
||||
$this->registry->dbFunctions()->setDB( 'mysql', 'remoteArchive', array( 'sql_database' => $this->settings['archive_remote_sql_database'],
|
||||
'sql_user' => $this->settings['archive_remote_sql_user'],
|
||||
'sql_pass' => $this->settings['archive_remote_sql_pass'],
|
||||
'sql_host' => $this->settings['archive_remote_sql_host'],
|
||||
'sql_charset' => $this->settings['archive_remote_sql_charset'],
|
||||
'sql_tbl_prefix' => $this->settings['sql_tbl_prefix'],
|
||||
'catchConnectionError' => true ) );
|
||||
|
||||
|
||||
$this->remoteDB = $this->registry->dbFunctions()->getDB('remoteArchive');
|
||||
|
||||
/* Check for connection issue */
|
||||
if ( $this->remoteDB->error )
|
||||
{
|
||||
$this->connectError = $this->remoteDB->error;
|
||||
$this->remoteDB = null;
|
||||
|
||||
$this->registry->dbFunctions()->unsetDB('remoteArchive');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->remoteDB = $this->registry->dbFunctions()->getDB('remoteArchive');
|
||||
|
||||
/* Check for connection issue */
|
||||
if ( $this->remoteDB->error )
|
||||
{
|
||||
$this->connectError = $this->remoteDB->error;
|
||||
$this->remoteDB = null;
|
||||
|
||||
$this->registry->dbFunctions()->unsetDB('remoteArchive');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->remoteDB = $this->DB;
|
||||
}
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'process':
|
||||
$this->process();
|
||||
break;
|
||||
default:
|
||||
$this->splash();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function show( $content, $url='' )
|
||||
{
|
||||
if ( $url )
|
||||
{
|
||||
$firstBit = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
|
||||
$refresh = "<meta http-equiv='refresh' content='0; url={$firstBit}?{$url}'>";
|
||||
}
|
||||
|
||||
if ( is_array( $content ) )
|
||||
{
|
||||
$content = implode( "<br />", $content );
|
||||
}
|
||||
|
||||
$html = <<<EOF
|
||||
<html>
|
||||
<head>
|
||||
<title>Archive Update</title>
|
||||
$refresh
|
||||
</head>
|
||||
<body>
|
||||
$content
|
||||
</body>
|
||||
</html>
|
||||
EOF;
|
||||
|
||||
print $html; exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* SPLASH
|
||||
*/
|
||||
function splash()
|
||||
{
|
||||
$txt = '';
|
||||
|
||||
if ( ! $this->remoteDB->checkForField( 'archive_forum_id', 'forums_archive_posts' ) )
|
||||
{
|
||||
$PRE = trim(ipsRegistry::dbFunctions()->getPrefix());
|
||||
|
||||
$this->remoteDB->query('ALTER TABLE ' . $PRE . 'forums_archive_posts ADD archive_forum_id INT(10) NOT NULL DEFAULT 0;');
|
||||
|
||||
$txt = "Adding archive_forum_id field to your database - Done<br />";
|
||||
}
|
||||
|
||||
$html = <<<EOF
|
||||
<strong>Archive Update for IP.Board 3.3.1</strong>
|
||||
<br />{$txt}
|
||||
<a href="?do=process">Continue</a>
|
||||
EOF;
|
||||
|
||||
$this->show( $html );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process
|
||||
*/
|
||||
function process()
|
||||
{
|
||||
$id = intval( $this->request['id'] );
|
||||
$lastId = 0;
|
||||
$done = intval( $this->request['done'] );
|
||||
$cycleDone = 0;
|
||||
$content = array();
|
||||
|
||||
|
||||
/* skipping? */
|
||||
$total = $this->remoteDB->buildAndFetch( array( 'select' => 'count(*) as count',
|
||||
'from' => 'forums_archive_posts' ) );
|
||||
|
||||
/* Fetch batch */
|
||||
$this->remoteDB->build( array( 'select' => '*',
|
||||
'from' => 'forums_archive_posts',
|
||||
'where' => 'archive_topic_id > ' . $id,
|
||||
'limit' => array( 0, self::TOPICS_PER_GO ),
|
||||
'order' => 'archive_topic_id ASC' ) );
|
||||
|
||||
|
||||
$o = $this->remoteDB->execute();
|
||||
|
||||
while( $row = $this->remoteDB->fetch( $o ) )
|
||||
{
|
||||
$cycleDone++;
|
||||
$lastId = $row['archive_topic_id'];
|
||||
|
||||
$content[] = "Updating topics " . ( $done + $cycleDone ) . " (archive_topic_id: " . $row['archive_topic_id'] . ") of " . $total['count'];
|
||||
|
||||
/* Fetch the forum ID */
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => 'forum_id',
|
||||
'from' => 'topics',
|
||||
'where' => 'tid=' . intval( $row['archive_topic_id'] ) ) );
|
||||
|
||||
if ( $topic['forum_id'] )
|
||||
{
|
||||
$this->remoteDB->update( 'forums_archive_posts', array( 'archive_forum_id' => $topic['forum_id'] ), 'archive_topic_id=' . $row['archive_topic_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/* More? */
|
||||
if ( $cycleDone )
|
||||
{
|
||||
/* Reset */
|
||||
$done += $cycleDone;
|
||||
|
||||
$this->show( $content, "do=process&id=" . $lastId . "&done=" . $done );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->show( "Process complete" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+---------------------------------------------------------------------------
|
||||
| IP.Board v3.4.5
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2008 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
+---------------------------------------------------------------------------
|
||||
| Invision Power Board IS NOT FREE SOFTWARE!
|
||||
+---------------------------------------------------------------------------
|
||||
| http://www.invisionpower.com/
|
||||
| > $Id: 10039 2011-12-20 19:49:28Z mmecham $
|
||||
| > $Revision: 10039 $
|
||||
| > $Date: 2011-12-20 14:49:28 -0500 (Tue, 20 Dec 2011) $
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
@set_time_limit( 3600 );
|
||||
|
||||
/**
|
||||
* Main public executable wrapper.
|
||||
*
|
||||
* Set-up and load module to run
|
||||
*
|
||||
* @package IP.Board
|
||||
* @author Matt Mecham
|
||||
* @version 3.0
|
||||
*/
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
elseif ( is_file( '../initdata.php' ) )
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( 'initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
private $processed = 0;
|
||||
private $parser;
|
||||
private $oldparser;
|
||||
private $start = 0;
|
||||
private $end = 0;
|
||||
|
||||
const TOPICS_PER_GO = 100;
|
||||
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->memberData = array();
|
||||
|
||||
/* Do we have a remote DB? */
|
||||
if ( $this->settings['archive_remote_sql_database'] && $this->settings['archive_remote_sql_user'] )
|
||||
{
|
||||
if ( ! is_object( $this->registry->dbFunctions()->getDB('remoteArchive') ) )
|
||||
{
|
||||
$this->registry->dbFunctions()->setDB( 'mysql', 'remoteArchive', array( 'sql_database' => $this->settings['archive_remote_sql_database'],
|
||||
'sql_user' => $this->settings['archive_remote_sql_user'],
|
||||
'sql_pass' => $this->settings['archive_remote_sql_pass'],
|
||||
'sql_host' => $this->settings['archive_remote_sql_host'],
|
||||
'sql_charset' => $this->settings['archive_remote_sql_charset'],
|
||||
'sql_tbl_prefix' => $this->settings['sql_tbl_prefix'],
|
||||
'catchConnectionError' => true ) );
|
||||
|
||||
|
||||
$this->remoteDB = $this->registry->dbFunctions()->getDB('remoteArchive');
|
||||
|
||||
/* Check for connection issue */
|
||||
if ( $this->remoteDB->error )
|
||||
{
|
||||
$this->connectError = $this->remoteDB->error;
|
||||
$this->remoteDB = null;
|
||||
|
||||
$this->registry->dbFunctions()->unsetDB('remoteArchive');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->remoteDB = $this->registry->dbFunctions()->getDB('remoteArchive');
|
||||
|
||||
/* Check for connection issue */
|
||||
if ( $this->remoteDB->error )
|
||||
{
|
||||
$this->connectError = $this->remoteDB->error;
|
||||
$this->remoteDB = null;
|
||||
|
||||
$this->registry->dbFunctions()->unsetDB('remoteArchive');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->remoteDB = $this->DB;
|
||||
}
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'process':
|
||||
$this->process();
|
||||
break;
|
||||
default:
|
||||
$this->splash();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function show( $content, $url='' )
|
||||
{
|
||||
if ( $url )
|
||||
{
|
||||
$firstBit = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
|
||||
$refresh = "<meta http-equiv='refresh' content='0; url={$firstBit}?{$url}'>";
|
||||
}
|
||||
|
||||
if ( is_array( $content ) )
|
||||
{
|
||||
$content = implode( "<br />", $content );
|
||||
}
|
||||
|
||||
$html = <<<EOF
|
||||
<html>
|
||||
<head>
|
||||
<title>Archive Update</title>
|
||||
$refresh
|
||||
</head>
|
||||
<body>
|
||||
$content
|
||||
</body>
|
||||
</html>
|
||||
EOF;
|
||||
|
||||
print $html; exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* SPLASH
|
||||
*/
|
||||
function splash()
|
||||
{
|
||||
$txt = '';
|
||||
|
||||
$html = <<<EOF
|
||||
<strong>Archive Update for IP.Board 3.3.3</strong>
|
||||
<br />{$txt}
|
||||
<a href="?do=process">Continue</a>
|
||||
EOF;
|
||||
|
||||
$this->show( $html );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process
|
||||
*/
|
||||
function process()
|
||||
{
|
||||
$data = $this->getRestoreData();
|
||||
$topics = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'tid',
|
||||
'from' => 'topics',
|
||||
'where' => 'topic_archive_status=4' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$topics[ $row['tid'] ] = $row['tid'];
|
||||
}
|
||||
|
||||
/* get maxes */
|
||||
if ( count( $topics ) )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'topic_id, max(pid) as max',
|
||||
'from' => 'posts',
|
||||
'where' => 'topic_id IN( ' . implode( ',', $topics ) . ')',
|
||||
'group' => 'topic_id' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$topics[ $row['topic_id'] ] = $row['max'];
|
||||
}
|
||||
}
|
||||
|
||||
$data['restore_manual_tids'] = $topics;
|
||||
|
||||
$this->setRestoreData( $data );
|
||||
|
||||
$this->show( "Process complete" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get restore data
|
||||
*/
|
||||
public function getRestoreData()
|
||||
{
|
||||
$data = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'core_archive_restore' ) );
|
||||
|
||||
if ( IPSLib::isSerialized( $data['restore_manual_tids'] ) )
|
||||
{
|
||||
$data['restore_manual_tids'] = unserialize( $data['restore_manual_tids'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['restore_manual_tids'] = array();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set restore data
|
||||
* @param array
|
||||
*/
|
||||
public function setRestoreData( $data )
|
||||
{
|
||||
if ( is_array( $data['restore_manual_tids'] ) )
|
||||
{
|
||||
$data['restore_manual_tids'] = serialize( $data['restore_manual_tids'] );
|
||||
}
|
||||
|
||||
$data['restore_min_tid'] = intval( $data['restore_min_tid'] );
|
||||
$data['restore_max_tid'] = intval( $data['restore_max_tid'] );
|
||||
|
||||
$this->DB->delete( 'core_archive_restore');
|
||||
$this->DB->insert( 'core_archive_restore', $data );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+---------------------------------------------------------------------------
|
||||
| IP.Board v3.4.5
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2008 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
+---------------------------------------------------------------------------
|
||||
| Invision Power Board IS NOT FREE SOFTWARE!
|
||||
+---------------------------------------------------------------------------
|
||||
| http://www.invisionpower.com/
|
||||
| > $Id: 10039 2011-12-20 19:49:28Z mmecham $
|
||||
| > $Revision: 10039 $
|
||||
| > $Date: 2011-12-20 14:49:28 -0500 (Tue, 20 Dec 2011) $
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
@set_time_limit( 3600 );
|
||||
|
||||
/**
|
||||
* Main public executable wrapper.
|
||||
*
|
||||
* Set-up and load module to run
|
||||
*
|
||||
* @package IP.Board
|
||||
* @author Matt Mecham
|
||||
* @version 3.0
|
||||
*/
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
elseif ( is_file( '../initdata.php' ) )
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( 'initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
private $processed = 0;
|
||||
private $parser;
|
||||
private $oldparser;
|
||||
private $start = 0;
|
||||
private $end = 0;
|
||||
|
||||
const TOPICS_PER_GO = 100;
|
||||
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->memberData = array();
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'media':
|
||||
$this->media();
|
||||
break;
|
||||
default:
|
||||
$this->splash();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function show( $content, $url='' )
|
||||
{
|
||||
if ( $url )
|
||||
{
|
||||
$firstBit = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
|
||||
$refresh = "<meta http-equiv='refresh' content='0; url={$firstBit}?{$url}'>";
|
||||
}
|
||||
|
||||
if ( is_array( $content ) )
|
||||
{
|
||||
$content = implode( "<br />", $content );
|
||||
}
|
||||
|
||||
$html = <<<EOF
|
||||
<html>
|
||||
<head>
|
||||
<title>3.4.x Post Repair</title>
|
||||
$refresh
|
||||
</head>
|
||||
<body>
|
||||
$content
|
||||
</body>
|
||||
</html>
|
||||
EOF;
|
||||
|
||||
print $html; exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* SPLASH
|
||||
*/
|
||||
function splash()
|
||||
{
|
||||
$txt = '';
|
||||
|
||||
$html = <<<EOF
|
||||
<strong>Please select a tool</strong>
|
||||
<br />{$txt}
|
||||
<a href="?do=media">Fix MEDIA (Youtube, etc)</a>
|
||||
EOF;
|
||||
|
||||
$this->show( $html );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix up media stuffs
|
||||
*/
|
||||
function media()
|
||||
{
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'posts',
|
||||
'where' => "post LIKE '%<object%'" ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$original = $row['post'];
|
||||
|
||||
preg_match_all( '#<object(.+?)</object>#i', $row['post'], $matches, PREG_SET_ORDER );
|
||||
|
||||
foreach( $matches as $val )
|
||||
{
|
||||
preg_match( '#http(?:s)?://(?:www.)?youtube.com/v/([\d\w-_]{4,})(&\S+?)?#', $row['post'], $matches );
|
||||
|
||||
if ( $matches[1] )
|
||||
{
|
||||
$row['post'] = str_replace( $val[0], '[media]http://youtube.com/watch?v=' . $matches[1] . '[/media]', $row['post'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $row['post'] && $row['pid'] && ( $original != $row['post'] ) )
|
||||
{
|
||||
$this->DB->update( 'posts', array( 'post' => $row['post'] ), 'pid=' . intval( $row['pid'] ) );
|
||||
|
||||
$output .= "Fixed Post Id: " . $row['pid'] . '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
$this->show( "<h2>Complete</h2>" . $output );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Main public executable wrapper.
|
||||
* Set-up and load module to run
|
||||
* Last Updated: $Date: 2011-03-31 11:17:44 +0100 (Thu, 31 Mar 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 8229 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPB_THIS_SCRIPT', 'admin' );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
$this->_doLang();
|
||||
$this->_doSkins();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild langs
|
||||
*/
|
||||
protected function _doSkins()
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$output = array();
|
||||
$errors = array();
|
||||
|
||||
/* Grab class */
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinImportExport.php' );/*noLibHook*/
|
||||
|
||||
$skinFunctions = new skinImportExport( $this->registry );
|
||||
|
||||
|
||||
/* Grab skin data */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'skin_collections' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
/* Bit of jiggery pokery... */
|
||||
if ( $row['set_key'] == 'default' )
|
||||
{
|
||||
$row['set_key'] = 'root';
|
||||
$row['set_id'] = 0;
|
||||
}
|
||||
|
||||
$skinSets[ $row['set_key'] ] = $row;
|
||||
}
|
||||
|
||||
/* Templates */
|
||||
foreach( ipsRegistry::$applications as $appDir => $appData )
|
||||
{
|
||||
foreach( $skinSets as $skinKey => $skinData )
|
||||
{
|
||||
$_PATH = IPSLib::getAppDir( $appDir ) . '/xml/';
|
||||
|
||||
$output[] = "Upgrading {$skinData['set_name']} for $appDir templates...";
|
||||
|
||||
if ( is_file( $_PATH . $appDir . '_' . $skinKey . '_templates.xml' ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Install
|
||||
//-----------------------------------------
|
||||
|
||||
$return = $skinFunctions->importTemplateAppXML( $appDir, $skinKey, $skinData['set_id'], TRUE );
|
||||
|
||||
$output[] = intval( $return['insertCount'] ) . " added, " . intval( $return['updateCount'] ) . " templates updated";
|
||||
}
|
||||
|
||||
if ( is_file( $_PATH . $appDir . '_' . $skinKey . '_css.xml' ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Install
|
||||
//-----------------------------------------
|
||||
|
||||
$return = $skinFunctions->importCSSAppXML( $appDir, $skinKey, $skinData['set_id'] );
|
||||
|
||||
$output[] = intval( $return['insertCount'] ) . " {$skinData['set_name']} CSS files inserted";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Replacements */
|
||||
foreach( $skinSets as $skinKey => $skinData )
|
||||
{
|
||||
if ( is_file( IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $skinKey . '.xml' ) )
|
||||
{
|
||||
$skinFunctions->importReplacementsXMLArchive( file_get_contents( IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $skinKey . '.xml' ), $skinKey );
|
||||
|
||||
$output[] = $skinKey . " replacements rebuilt";
|
||||
}
|
||||
}
|
||||
|
||||
/* reset ID */
|
||||
//$skinSets['root']['set_id'] = 1;
|
||||
|
||||
/* Recache */
|
||||
foreach( $skinSets as $skinKey => $skinData )
|
||||
{
|
||||
$skinFunctions->rebuildPHPTemplates( $skinData['set_id'] );
|
||||
|
||||
if ( $skinFunctions->fetchErrorMessages() !== FALSE )
|
||||
{
|
||||
$output[] = implode( "<br />", $skinFunctions->fetchErrorMessages() );
|
||||
}
|
||||
|
||||
$skinFunctions->rebuildCSS( $skinData['set_id'] );
|
||||
|
||||
if ( $skinFunctions->fetchErrorMessages() !== FALSE )
|
||||
{
|
||||
$output[] = implode( "<br />", $skinFunctions->fetchErrorMessages() );
|
||||
}
|
||||
|
||||
$skinFunctions->rebuildReplacementsCache( $skinData['set_id'] );
|
||||
|
||||
if ( $skinFunctions->fetchErrorMessages() !== FALSE )
|
||||
{
|
||||
$output[] = implode( "<br />", $skinFunctions->fetchErrorMessages() );
|
||||
}
|
||||
|
||||
$output[] = $skinKey . " recached";
|
||||
}
|
||||
|
||||
/* recache other */
|
||||
$skinFunctions->rebuildSkinSetsCache();
|
||||
|
||||
$this->_print( implode( "\n", $output ) );
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "COMPLETE. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild langs
|
||||
*/
|
||||
protected function _doLang()
|
||||
{
|
||||
/* Grab class */
|
||||
require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/languages/manage_languages.php' );/*noLibHook*/
|
||||
$lang = new admin_core_languages_manage_languages( $this->registry );
|
||||
$lang->makeRegistryShortcuts( $this->registry );
|
||||
|
||||
$start = time();
|
||||
|
||||
foreach( ipsRegistry::$applications as $app => $app_data )
|
||||
{
|
||||
$output[] = "Upgrading ADMIN languages...";
|
||||
$_PATH = IPSLib::getAppDir( $app ) . '/xml/';
|
||||
|
||||
/* Loop through the xml directory and look for lang packs */
|
||||
try
|
||||
{
|
||||
foreach( new DirectoryIterator( $_PATH ) as $f )
|
||||
{
|
||||
if( preg_match( "#(admin|public)_(.+?)_language_pack.xml#", $f->getFileName() ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Import and cache
|
||||
//-----------------------------------------
|
||||
|
||||
$output[] = "Importing " . $f->getFileName();
|
||||
|
||||
$this->request['file_location'] = $_PATH . $f->getFileName();
|
||||
$lang->imprtFromXML( true, true, true, $app );
|
||||
}
|
||||
}
|
||||
} catch ( Exception $e ) {}
|
||||
}
|
||||
|
||||
$this->_print( implode( "\n", $output ) );
|
||||
$this->_print( "\nAll languages imported and recached" );
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "\COMPLETE. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
print nl2br( preg_replace( "#\n{1,}#", "\n", $message ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,303 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Main public executable wrapper.
|
||||
* Set-up and load module to run
|
||||
* Last Updated: $Date: 2012-06-06 15:26:34 -0400 (Wed, 06 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10878 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'admin' );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
elseif ( is_file( '../initdata.php' ) )
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( 'initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IP.Board Shell Get Stuff Ready For Release Tool\n--------------------------------------------\n" );
|
||||
$this->_print( "What do you wish to do? [l=Rebuild and Export Lang, s=Rebuild and Export Skins, a=Both]\nEnter: " );
|
||||
|
||||
$option = $this->_fetchOption();
|
||||
|
||||
switch( $option )
|
||||
{
|
||||
case 'l':
|
||||
$this->_doLang();
|
||||
break;
|
||||
case 's':
|
||||
$this->_doSkins();
|
||||
break;
|
||||
case 'a':
|
||||
$this->_doLang();
|
||||
$this->_doSkins();
|
||||
break;
|
||||
default:
|
||||
$this->_print( "\nIncorrect option" );
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild langs
|
||||
*/
|
||||
protected function _doSkins()
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$messages = array();
|
||||
$errors = array();
|
||||
|
||||
/* Grab class */
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinImportExport.php' );/*noLibHook*/
|
||||
|
||||
$this->skinFunctions = new skinImportExport( $this->registry );
|
||||
|
||||
/* This is which skins we want to export for default installations */
|
||||
$skinIDs = array_values( $this->skinFunctions->remapData['export'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Can do .. stuff?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! is_writable( IPS_ROOT_PATH . 'setup/xml/skins' ) )
|
||||
{
|
||||
$this->_print( 'Cannot write to /admin/setup/xml/skins' );
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Rebuild stuff
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $skinIDs as $id )
|
||||
{
|
||||
$msg = $this->skinFunctions->rebuildMasterCSS( $id );
|
||||
$messages[] = "<strong>CSS Rebuilt for $id</strong>";
|
||||
$messages = array_merge( $messages, $msg, $this->skinFunctions->fetchMessages( TRUE ) );
|
||||
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
|
||||
|
||||
$msg = $this->skinFunctions->rebuildMasterFromPHP( $id );
|
||||
$messages[] = "<strong>HTML Rebuilt for $id</strong>";
|
||||
$messages = array_merge( $messages, $msg, $this->skinFunctions->fetchMessages( TRUE ) );
|
||||
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
|
||||
|
||||
$msg = $this->skinFunctions->rebuildMasterReplacements( $id );
|
||||
$messages[] = "<strong>Replacements Rebuilt for $id</strong>";
|
||||
$messages = array_merge( $messages, (array)$msg, $this->skinFunctions->fetchMessages( TRUE ) );
|
||||
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
|
||||
}
|
||||
|
||||
/* Got any errors? */
|
||||
if ( count( $errors ) )
|
||||
{
|
||||
$this->_print( 'ERROR: ' . implode( "\n *", $errors ) );
|
||||
//exit();
|
||||
}
|
||||
|
||||
$this->skinFunctions->rebuildTreeInformation();
|
||||
$this->skinFunctions->rebuildSkinSetsCache();
|
||||
|
||||
//-----------------------------------------
|
||||
// Rebuild skin caches
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $skinIDs as $id )
|
||||
{
|
||||
$setData = $this->skinFunctions->fetchSkinData( $id );
|
||||
|
||||
$key = $setData['set_key'];
|
||||
|
||||
if ( $id > 0 )
|
||||
{
|
||||
$this->skinFunctions->rebuildPHPTemplates( $id );
|
||||
$messages[] = "<strong>PHP Templates Recached for $key</strong>";
|
||||
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
|
||||
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
|
||||
|
||||
$this->skinFunctions->rebuildCSS( $id );
|
||||
$messages[] = "<strong>CSS Recached for $key</strong>";
|
||||
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
|
||||
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
|
||||
|
||||
$this->skinFunctions->rebuildReplacementsCache( $id );
|
||||
$messages[] = "<strong>Replacements Recached for $key</strong>";
|
||||
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
|
||||
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
|
||||
}
|
||||
|
||||
/* Build and write XML files for replacements and CSS */
|
||||
$replacementsXML = $this->skinFunctions->generateReplacementsXML( $id, FALSE );
|
||||
|
||||
@unlink( IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $key . '.xml', $replacementsXML );
|
||||
|
||||
if ( $replacementsXML )
|
||||
{
|
||||
if ( ! @file_put_contents( IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $key . '.xml', $replacementsXML ) )
|
||||
{
|
||||
$errors[] = "Cannot write: " . IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $key . '.xml';
|
||||
}
|
||||
else
|
||||
{
|
||||
$messages[] = "Written: " . IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $key . '.xml';
|
||||
}
|
||||
}
|
||||
|
||||
/* Export all CSS - Function loops through all skin sets */
|
||||
$this->skinFunctions->exportAllAppCSS( $id );
|
||||
$messages[] = "<strong>App CSS Written For $key</strong>";
|
||||
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
|
||||
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
|
||||
|
||||
/* Export all CSS - Function loops through all skin sets */
|
||||
$this->skinFunctions->exportAllAppTemplates( $id );
|
||||
$messages[] = "<strong>App XML Written For $key</strong>";
|
||||
$messages = array_merge( $messages, $this->skinFunctions->fetchMessages( TRUE ) );
|
||||
$errors = array_merge( $errors , $this->skinFunctions->fetchErrorMessages( TRUE ) );
|
||||
|
||||
/* Got any errors? */
|
||||
if ( count( $errors ) )
|
||||
{
|
||||
$this->_print( 'ERROR: ' . implode( "\n *", $errors ) );
|
||||
//exit();
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate skin sets XML */
|
||||
$skinSetXML = $this->skinFunctions->generateMasterSkinSetXML( $skinIDs );
|
||||
|
||||
@unlink( IPS_ROOT_PATH . 'setup/xml/skins/setsData.xml' );
|
||||
|
||||
if ( ! @file_put_contents( IPS_ROOT_PATH . 'setup/xml/skins/setsData.xml', $skinSetXML ) )
|
||||
{
|
||||
$errors[] = "Cannot write:: " . IPS_ROOT_PATH . 'setup/xml/skins/setsData.xml';
|
||||
}
|
||||
else
|
||||
{
|
||||
$messages[] = "Written: " . IPS_ROOT_PATH . 'setup/xml/skins/setsData.xml';
|
||||
}
|
||||
|
||||
$this->_print( implode( "\n", $messages ) );
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "COMPLETE. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild langs
|
||||
*/
|
||||
protected function _doLang()
|
||||
{
|
||||
/* Grab class */
|
||||
require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/languages/manage_languages.php' );/*noLibHook*/
|
||||
$lang = new admin_core_languages_manage_languages( $this->registry );
|
||||
$lang->makeRegistryShortcuts( $this->registry );
|
||||
|
||||
$start = time();
|
||||
|
||||
foreach( ipsRegistry::$applications as $app => $app_data )
|
||||
{
|
||||
$this->_print("\nStarting App: " . $app_data['app_title'] );
|
||||
$_start = time();
|
||||
|
||||
/* Stuff the post array */
|
||||
$_POST['apps'] = array( $app => $app );
|
||||
$msgs = $lang->importFromCacheFiles( FALSE );
|
||||
|
||||
$_end = time();
|
||||
$_tkn = ( $_end - $_start) / 60;
|
||||
|
||||
$this->_print( "\nDone. Took " . $_tkn . "m\n" . implode( "\n", $msgs ) );
|
||||
}
|
||||
|
||||
$this->_print( "\nAll languages imported" );
|
||||
|
||||
foreach( ipsRegistry::$applications as $app_dir => $app_data )
|
||||
{
|
||||
$this->_print("\nExporting XML for App: " . $app_data['app_title'] );
|
||||
|
||||
$this->request['app_dir'] = $app_dir;
|
||||
|
||||
$this->request['type'] = 'admin';
|
||||
$lang->languageExportToXML( 1, 1 );
|
||||
|
||||
$this->request['type'] = 'public';
|
||||
$lang->languageExportToXML( 1, 1 );
|
||||
}
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "\nCOMPLETE. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,285 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Rebuilds stuff from XML
|
||||
* Last Updated: $Date: 2012-06-06 15:26:34 -0400 (Wed, 06 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10878 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'admin' );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
elseif ( is_file( '../initdata.php' ) )
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( 'initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
/* Ensure it's CLI */
|
||||
$cli = php_sapi_name() === 'cli';
|
||||
|
||||
if ( ! $cli )
|
||||
{
|
||||
print "<html><head><title>Warning</title></head>\n";
|
||||
print "<body style='text-align:center'>\n";
|
||||
print "This script is meant to be run via command line<br />\n";
|
||||
print "More information:<br />\n";
|
||||
print "<a href=\"http://www.google.com/search?hl=en&q=php+cli+windows\" target=\"_blank\">http://www.google.com/search?hl=en&q=php+cli+windows</a><br />\n";
|
||||
print "This script will not run through a webserver.<br />\n";
|
||||
print "</body></html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
print "\n ";
|
||||
print "\n (_) _ __ ____ ";
|
||||
print "\n | || '_ \ / ___' ";
|
||||
print "\n | || |_) | \__. ";
|
||||
print "\n | || .__/.\___ \ ";
|
||||
print "\n |_||_| |_______/ \n\n";
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IN_DEV build tool" );
|
||||
$this->_print( "This tool will create the required directories and files to run in IN_DEV\n--------------------------------------------\n" );
|
||||
|
||||
/* Is IN_DEV on? */
|
||||
if ( ! IN_DEV )
|
||||
{
|
||||
$this->_print( "IN_DEV is not on. Please edit 'conf_global.php' and add: define( 'IN_DEV', 1 );" );
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Can we write into require folders? */
|
||||
$req = array( 'cache', 'cache/skin_cache', 'cache/lang_cache', 'cache/lang_cache/1', PUBLIC_DIRECTORY . '/style_css' );/*noLibHook*/
|
||||
$stop = false;
|
||||
|
||||
foreach( $req as $r )
|
||||
{
|
||||
if ( ! is_dir( DOC_IPS_ROOT_PATH . $r ) )
|
||||
{
|
||||
$this->_print( "Cannot locate: $r - please CHMOD appropriately and re-run" );
|
||||
$stop = true;
|
||||
}
|
||||
|
||||
if ( ! is_writable( DOC_IPS_ROOT_PATH . $r ) )
|
||||
{
|
||||
$this->_print( "Cannot write to: $r - please CHMOD appropriately and re-run" );
|
||||
$stop = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $stop )
|
||||
{
|
||||
exit();
|
||||
}
|
||||
|
||||
$this->_print( "Hit Any Key To Continue: " );
|
||||
|
||||
$option = $this->_fetchOption();
|
||||
|
||||
/* Export all skins required */
|
||||
$this->_doSkins();
|
||||
|
||||
/* Export all language bits */
|
||||
$this->_doLang();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild skins
|
||||
*/
|
||||
protected function _doSkins()
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$output = array();
|
||||
$errors = array();
|
||||
|
||||
/* Grab class */
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinImportExport.php' );/*noLibHook*/
|
||||
|
||||
$skinFunctions = new skinImportExport( $this->registry );
|
||||
|
||||
/* Fetch master dirs */
|
||||
$master = $skinFunctions->fetchMasterKeys();
|
||||
|
||||
if ( ! count( $master ) )
|
||||
{
|
||||
$this->_print( "Could not locate any master skin keys" );
|
||||
exit();
|
||||
}
|
||||
|
||||
/* PHP */
|
||||
foreach( $master as $m )
|
||||
{
|
||||
$path = ( $m == 'root' ) ? IPS_CACHE_PATH . 'cache/skin_cache/master_skin' : IPS_CACHE_PATH . 'cache/skin_cache/master_skin_' . $m;
|
||||
$path = ( $m == 'xmlskin' ) ? IPS_CACHE_PATH . 'cache/skin_cache/master_skin_xml' : $path;
|
||||
|
||||
if ( is_dir( $path ) )
|
||||
{
|
||||
$this->_print( "$path already exists..." );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! mkdir( $path, IPS_FOLDER_PERMISSION ) )
|
||||
{
|
||||
$this->_print( "Could not create $path" );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
@chmod( $path, IPS_FOLDER_PERMISSION );
|
||||
$this->_print( "$path created..." );
|
||||
}
|
||||
}
|
||||
|
||||
/* CSS */
|
||||
foreach( $master as $m )
|
||||
{
|
||||
$path = ( $m == 'root' ) ? DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/master_css' : DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/master_css_' . $m;
|
||||
$path = ( $m == 'xmlskin' ) ? DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_css/master_css_xml' : $path;
|
||||
|
||||
if ( is_dir( $path ) )
|
||||
{
|
||||
$this->_print( "$path already exists..." );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! mkdir( $path, IPS_FOLDER_PERMISSION ) )
|
||||
{
|
||||
$this->_print( "Could not create $path" );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
@chmod( $path, IPS_FOLDER_PERMISSION );
|
||||
$this->_print( "$path created..." );
|
||||
}
|
||||
}
|
||||
|
||||
/* Now create master dirs for PHP */
|
||||
foreach( $master as $m )
|
||||
{
|
||||
$dir = ( $m == 'root' ) ? 'master_skin' : 'master_skin_' . $m;
|
||||
$dir = ( $m == 'xmlskin' ) ? 'master_skin_xml' : $dir;
|
||||
|
||||
$skinFunctions->writeMasterSkin( $m, $dir );
|
||||
|
||||
$this->_print( "PHP templates written for $m" );
|
||||
}
|
||||
|
||||
/* Now create master dirs for CSS */
|
||||
foreach( $master as $m )
|
||||
{
|
||||
$dir = ( $m == 'root' ) ? 'master_css' :'master_css_' . $m;
|
||||
$dir = ( $m == 'xmlskin' ) ? 'master_css_xml' : $dir;
|
||||
|
||||
$skinFunctions->writeMasterSkinCss( $m, $dir );
|
||||
|
||||
$this->_print( "CSS written for $m" );
|
||||
}
|
||||
|
||||
/* Now create master dirs for replacements */
|
||||
foreach( $master as $m )
|
||||
{
|
||||
$dir = ( $m == 'root' ) ? 'master_skin' : 'master_skin_' . $m;
|
||||
$dir = ( $m == 'xmlskin' ) ? 'master_skin_xml' : $dir;
|
||||
|
||||
$skinFunctions->writeMasterSkinReplacements( $m, $dir );
|
||||
|
||||
$this->_print( "Replacements written for $m" );
|
||||
}
|
||||
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "COMPLETE. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild langs
|
||||
*/
|
||||
protected function _doLang()
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
|
||||
/* Grab class */
|
||||
require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/languages/manage_languages.php' );/*noLibHook*/
|
||||
$lang = new admin_core_languages_manage_languages( $this->registry );
|
||||
$lang->makeRegistryShortcuts( $this->registry );
|
||||
|
||||
$lang->cacheToDisk( 'master' );
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "Master languages written" );
|
||||
$this->_print( "COMPLETE. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,280 @@
|
||||
<?php
|
||||
|
||||
define( 'IPB_VERSION', '3.4' );
|
||||
|
||||
?>
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<title>IP.Board <?php print IPB_VERSION; ?> - Requirements Checker</title>
|
||||
<style type='text/css'>
|
||||
.pass {
|
||||
color: green;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fail {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.warn {
|
||||
color: orange;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.what-you-should-do {
|
||||
color: grey;
|
||||
font-size: 12px;
|
||||
font-style: italic;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 2px;
|
||||
padding: 4px;
|
||||
border-bottom: 1px dotted grey;
|
||||
font-size: 15px;
|
||||
font-family: "Arial, Verdana";
|
||||
}
|
||||
|
||||
p.final {
|
||||
border-bottom: 0px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>IP.Board <?php print IPB_VERSION; ?> Requirements Checker</h1>
|
||||
|
||||
<?php
|
||||
|
||||
$extensions = get_loaded_extensions();
|
||||
$version = phpversion();
|
||||
$minVersion = '5.2.0';
|
||||
|
||||
//-----------------------------------------
|
||||
// Checking against required version
|
||||
//-----------------------------------------
|
||||
|
||||
$checkRequiredVersion = version_compare( $minVersion, $version, '<=' );
|
||||
flushOutput( "Проверка версии PHP (минимум - {$minVersion})...", $checkRequiredVersion, "Вы должны установить PHP версии {$minVersion} или выше для запуска IP.Board " . IPB_VERSION . ". Сейчас работает версия {$version}. Пожалуйста, свяжитесь с вашим хостинг-провайдером для обновления PHP до версии {$minVersion} или выше." );
|
||||
|
||||
print "<p>You are running PHP <strong>{$version}</strong></p>";
|
||||
|
||||
//-----------------------------------------
|
||||
// Check for zend guard
|
||||
//-----------------------------------------
|
||||
|
||||
$hasZend = false;
|
||||
|
||||
if ( function_exists( 'zend_loader_enabled' ) )
|
||||
{
|
||||
if ( @zend_loader_enabled() === true )
|
||||
{
|
||||
$hasZend = true;
|
||||
}
|
||||
}
|
||||
|
||||
flushOutput( "Только для IP.Nexus: Проверка обработки скриптов, закодированных Zend Guard...", $hasZend, "Ваш сервер не может обрабатывать закодированные скрипты IP.Nexus. Это не влияет на IP.Board, IP.Downloads. IP.Blog, IP.Gallery, IP.Content, IP.Chat" );
|
||||
|
||||
//-----------------------------------------
|
||||
// Memory limit
|
||||
//-----------------------------------------
|
||||
|
||||
$_memLimit = null;
|
||||
$_recLimit = 128;
|
||||
|
||||
if( @ini_get('memory_limit') )
|
||||
{
|
||||
$_memLimit = @ini_get('memory_limit');
|
||||
}
|
||||
|
||||
if( $_memLimit )
|
||||
{
|
||||
$_intLimit = $_memLimit;
|
||||
$_intRec = $_recLimit * 1024 * 1024;
|
||||
|
||||
preg_match( "#^(\d+)(\w+)$#", strtolower($_intLimit), $match );
|
||||
|
||||
if( $match[2] == 'g' )
|
||||
{
|
||||
$_intLimit = intval( $_intLimit ) * 1024 * 1024 * 1024;
|
||||
}
|
||||
else if ( $match[2] == 'm' )
|
||||
{
|
||||
$_intLimit = intval( $_intLimit ) * 1024 * 1024;
|
||||
}
|
||||
else if ( $match[2] == 'k' )
|
||||
{
|
||||
$_intLimit = intval( $_intLimit ) * 1024;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_intLimit = intval( $_intLimit );
|
||||
}
|
||||
|
||||
if( $_intLimit >= $_intRec )
|
||||
{
|
||||
flushOutput( "Проверка выделения памяти ({$_recLimit}M или больше рекомендуется)...", true, "Ваш сервер ограничивает объем выделяемой памяти(memory_limit): {$_memLimit}" );
|
||||
}
|
||||
else
|
||||
{
|
||||
flushOutput( "Проверка выделения памяти ({$_recLimit}M или больше рекомендуется)...", 2, "Ваш сервер ограничивает объем выделяемой памяти(memory_limit): {$_memLimit}. Вы можете использовать IP.Board, но свяжитесь с вашим хостинг-провайдером и попросите его увеличить memory_limit до {$_recLimit}M, чтобы избежать ошибок в будущем. Возможно прекращение работы скриптов при обработке больших объемов данных" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flushOutput( "Проверка выделения памяти ({$_recLimit}M или больше рекомендуется)...", 2, "Не удалось получить значение переменной memory_limit" );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Checking for SPL
|
||||
//-----------------------------------------
|
||||
|
||||
$splExists = in_array( 'SPL', $extensions );
|
||||
flushOutput( "Проверка SPL...", $splExists, "IP.Board " . IPB_VERSION . " требуется расширение PHP SPL. Пожалуйста, свяжитесь с вашим хостинг-провайдером для установки <a href='http://www.php.net/manual/ru/spl.setup.php'>библиотеки SPL</a>." );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checking for DOM XML
|
||||
//-----------------------------------------
|
||||
|
||||
$domXML = in_array( 'dom', $extensions );
|
||||
flushOutput( "Проверка обработки DOM XML...", $domXML, "IP.Board " . IPB_VERSION . " требуется расширение обработчика DOM XML. Пожалуйста, свяжитесь с вашим хостинг-провайдером для установки <a href='http://www.php.net/manual/ru/dom.setup.php'>библиотеки libxml2</a>." );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check for GD2
|
||||
//-----------------------------------------
|
||||
|
||||
$gd2 = in_array( 'gd', $extensions );
|
||||
flushOutput( "Проверка библиотеки GD...", $gd2, "IP.Board " . IPB_VERSION . " требуется библиотека GD2. Пожалуйста, свяжитесь с вашим хостинг-провайдером для установки <a href='http://us.php.net/manual/ru/image.setup.php'>библиотеки libgd</a>." );
|
||||
|
||||
if( function_exists( 'gd_info' ) )
|
||||
{
|
||||
$gdInfo = gd_info();
|
||||
$fail = true;
|
||||
|
||||
if( $gdInfo["GD Version"] )
|
||||
{
|
||||
preg_match( "/.*?([\d\.]+).*?/", $gdInfo["GD Version"], $matches );
|
||||
|
||||
if( $matches[1] )
|
||||
{
|
||||
$compareVersions = version_compare( '2.0', $matches[1], '<=' );
|
||||
|
||||
if( !$compareVersions )
|
||||
{
|
||||
$fail = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flushOutput( "Проверка GD2...", $fail, "Библиотека GD установлена, но IP.Board " . IPB_VERSION . " требуется библиотека GD версии 2. Версия переданная вашим сервером '{$gdInfo['GD Version']}'. Пожалуйста убедитесь, что используете GD версии 2, и обновите <a href='http://us.php.net/manual/ru/image.setup.php'>библиотеку libgd</a> при необходимости." );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Checking for mysql extension
|
||||
//-----------------------------------------
|
||||
|
||||
$mysql = in_array( 'mysql', $extensions );
|
||||
$mysqli = in_array( 'mysqli', $extensions );
|
||||
flushOutput( "Проверка mysql...", ( $mysql OR $mysqli ), "Ваш сервер не имеет библиотеки mysql, попросите хостера установить поддержку <a href='http://us.php.net/manual/ru/mysqli.setup.php'>mysqli</a>." );
|
||||
|
||||
if( $mysql AND !$mysqli )
|
||||
{
|
||||
flushOutput( "Проверка поддержки mysqli...", false, "Расширение mysqli рекомендуется вместо стандартного интерфейса mysql. Форум может обойтись и без него, но, если возможно, установите <a href='http://us.php.net/manual/ru/mysqli.setup.php'>его</a> для улучшения скорости и безопасности работы." );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Checking for JSON
|
||||
//-----------------------------------------
|
||||
|
||||
$json = in_array( 'json', $extensions );
|
||||
flushOutput( "Проверка JSON...", $json, "Расширение PHP JSON необходимо для функционирования форума. Узнайте как установить <a href='http://us.php.net/manual/ru/json.setup.php'>расширение json</a>." );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checking for openSSL
|
||||
//-----------------------------------------
|
||||
|
||||
$openssl = in_array( 'openssl', $extensions ) ? true : 2;
|
||||
flushOutput( "Проверка openSSL...", $openssl, "OpenSSL необходим для модулей связи с Facebook, Twitter, и модуля Subscription Manager. Если вы не используете ни один из этих модулей, то можно обойтись без этого расширения, иначе вам необходимо установить<a href='http://us2.php.net/manual/ru/openssl.installation.php'> расширение openssl</a>." );
|
||||
|
||||
//-----------------------------------------
|
||||
// Suhosin
|
||||
//-----------------------------------------
|
||||
|
||||
if( extension_loaded( 'suhosin' ) )
|
||||
{
|
||||
$_postMaxVars = @ini_get('suhosin.post.max_vars');
|
||||
$_reqMaxVars = @ini_get('suhosin.request.max_vars');
|
||||
$_getMaxLen = @ini_get('suhosin.get.max_value_length');
|
||||
$_postMaxLen = @ini_get('suhosin.post.max_value_length');
|
||||
$_reqMaxLen = @ini_get('suhosin.request.max_value_length');
|
||||
$_reqMaxVar = @ini_get('suhosin.request.max_varname_length');
|
||||
|
||||
$_indPMV = $_postMaxVars < 4096 ? 2 : true;
|
||||
$_indRMV = $_reqMaxVars < 4096 ? 2 : true;
|
||||
$_indGML = $_getMaxLen < 2000 ? 2 : true;
|
||||
$_indPML = $_postMaxLen < 1000000 ? 2 : true;
|
||||
$_indRML = $_reqMaxLen < 1000000 ? 2 : true;
|
||||
$_indRMVL = $_reqMaxVar < 350 ? 2 : true;
|
||||
|
||||
flushOutput( "suhosin.post.max_vars (4096 or better recommended)...", $_indPMV, "Your value: {$_postMaxVars}. Can prevent some forms (especially in the ACP) from saving properly." );
|
||||
flushOutput( "suhosin.request.max_vars (4096 or better recommended)...", $_indRMV, "Your value: {$_reqMaxVars}. Can prevent some forms (especially in the ACP) from saving properly." );
|
||||
flushOutput( "suhosin.get.max_value_length (2000 or better recommended)...", $_indGML, "Your value: {$_postMaxLen}. Can prevent very long URLs from loading correctly." );
|
||||
flushOutput( "suhosin.post.max_value_length (1000000 or better recommended)...", $_indPML, "Your value: {$_postMaxLen}. Can prevent very large posts or other form submissions from saving properly." );
|
||||
flushOutput( "suhosin.request.max_value_length (1000000 or better recommended)...", $_indRML, "Your value: {$_reqMaxLen}. Can prevent very large posts or other form submissions from saving properly." );
|
||||
flushOutput( "suhosin.request.max_varname_length (350 or better recommended)...", $_indRMVL, "Your value: {$_reqMaxVar}. Can prevent long friendly URLs from loading correctly." );
|
||||
}
|
||||
|
||||
$testtext="тестовый текст в кодировке utf-8";
|
||||
$pcre=($testtext == preg_replace( '/(^|\W)дир(\W|$)/iu', "\\1замена\\2", $testtext ))?true:false;
|
||||
flushOutput( "Проверка расширения PCRE на правильную работу со строками в формате UTF-8...", $pcre, "Библиотека PCRE неправильно обрабатывает регулярные выражения в кодировке UTF-8, обратитесь к хостинг-провайдеру для исправления этой ошибки. Неправильная работа этой функции может привести к ошикам при работе с русскими именами пользователей, ошибкам фильтра нецензурных слов и т.д." );
|
||||
|
||||
|
||||
flushOutput( 'Проверка функции filter_var()...', function_exists ( 'filter_var' ), 'Функция отсутствует, это может привести к фатальным ошибкам php и остановке выполнения скриптов' );
|
||||
//-----------------------------------------
|
||||
// Flush output function
|
||||
//-----------------------------------------
|
||||
|
||||
function flushOutput( $checking, $result, $errorText )
|
||||
{
|
||||
print "<p>" . $checking;
|
||||
|
||||
if( $result === 2 )
|
||||
{
|
||||
print "<span class='warn'>ВНИМАНИЕ</span><br /><span class='what-you-should-do'>{$errorText}</span>";
|
||||
}
|
||||
else if( !$result )
|
||||
{
|
||||
print "<span class='fail'>ОШИБКА</span><br /><span class='what-you-should-do'>{$errorText}</span>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<span class='pass'>ОК</span>";
|
||||
}
|
||||
|
||||
print "</p>";
|
||||
|
||||
flush();
|
||||
@ob_flush();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p class='final'>Имейте в виду, что MySQL версии 4.1 или выше (MySQL 5.0 рекомендуется) необходим IP.Board <?php print IPB_VERSION; ?>. Попросите администратора вашего сервера проверить версию MySQL если не уверены.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+---------------------------------------------------------------------------
|
||||
| IP.Board v3.4.5
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2008 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
+---------------------------------------------------------------------------
|
||||
| Invision Power Board IS NOT FREE SOFTWARE!
|
||||
+---------------------------------------------------------------------------
|
||||
| http://www.invisionpower.com/
|
||||
| > $Id: galleryRebuild4_php.php 10039 2011-12-20 19:49:28Z mmecham $
|
||||
| > $Revision: 10039 $
|
||||
| > $Date: 2011-12-20 14:49:28 -0500 (Tue, 20 Dec 2011) $
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
@set_time_limit( 3600 );
|
||||
|
||||
/**
|
||||
* Main public executable wrapper.
|
||||
*
|
||||
* Set-up and load module to run
|
||||
*
|
||||
* @package IP.Board
|
||||
* @author Matt Mecham
|
||||
* @version 3.0
|
||||
*/
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
private $processed = 0;
|
||||
private $parser;
|
||||
private $oldparser;
|
||||
private $start = 0;
|
||||
private $end = 0;
|
||||
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->memberData = array();
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'save':
|
||||
$this->save();
|
||||
break;
|
||||
default:
|
||||
$this->splash();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function show( $content, $url='' )
|
||||
{
|
||||
if ( $url )
|
||||
{
|
||||
$firstBit = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
|
||||
$refresh = "<meta http-equiv='refresh' content='0; url={$firstBit}?{$url}'>";
|
||||
}
|
||||
|
||||
if ( is_array( $content ) )
|
||||
{
|
||||
$content = implode( "<br />", $content );
|
||||
}
|
||||
|
||||
$html = <<<EOF
|
||||
<html>
|
||||
<head>
|
||||
<title>Group Edit BitWise</title>
|
||||
$refresh
|
||||
</head>
|
||||
<body>
|
||||
$content
|
||||
</body>
|
||||
</html>
|
||||
EOF;
|
||||
|
||||
print $html; exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* SPLASH
|
||||
*/
|
||||
function splash()
|
||||
{
|
||||
/* Unpack bitwise fields */
|
||||
$_tmp = IPSBWOptions::thaw( 0, 'groups', 'global' );
|
||||
$groups = $this->caches['group_cache'];
|
||||
|
||||
foreach( $_tmp as $k => $v )
|
||||
{
|
||||
$radio .= "<tr>
|
||||
<td><strong>{$k}</strong></td>
|
||||
<td><input type='radio' name='bitwise[$k]' value='leave' checked='checked' /> <em>Leave as per group</em></td>
|
||||
<td><input type='radio' name='bitwise[$k]' value='1' /> <span style='color:green'>ON</span></td>
|
||||
<td><input type='radio' name='bitwise[$k]' value='0' /> <span style='color:red'>OFF</span></td>
|
||||
</tr>";
|
||||
|
||||
}
|
||||
|
||||
foreach( $groups as $id => $data )
|
||||
{
|
||||
$groupHTML .= "<div><input type='checkbox' name='groups[$id]' value='1' /> " . $data['g_title'] . "</div>\n";
|
||||
}
|
||||
|
||||
$html = <<<EOF
|
||||
<form action="?do=save" method="POST">
|
||||
Bitwise Values
|
||||
<table>{$radio}</table>
|
||||
<br />
|
||||
Apply to groups:
|
||||
{$groupHTML}
|
||||
<br />
|
||||
<input type="submit" value="Save" />
|
||||
</form>
|
||||
EOF;
|
||||
|
||||
$this->show( $html );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert images
|
||||
*/
|
||||
function save()
|
||||
{
|
||||
$gids = $_POST['groups'];
|
||||
$bitwise = $_POST['bitwise'];
|
||||
$groups = $this->caches['group_cache'];
|
||||
|
||||
foreach( $gids as $id => $val )
|
||||
{
|
||||
$thisGroup = $groups[ $id ];
|
||||
|
||||
foreach( $bitwise as $k => $v )
|
||||
{
|
||||
if ( $v != 'leave' )
|
||||
{
|
||||
$thisGroup[ $k ] = intval( $v );
|
||||
}
|
||||
}
|
||||
|
||||
$g_bitoptions = IPSBWOPtions::freeze( $thisGroup, 'groups', 'global' );
|
||||
|
||||
$this->DB->update( 'groups', array( 'g_bitoptions' => $g_bitoptions ), 'g_id=' . $id );
|
||||
}
|
||||
|
||||
$this->rebuildGroupCache();
|
||||
|
||||
$this->show('Done');
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuilds the group cache
|
||||
*
|
||||
* @return @e void
|
||||
*/
|
||||
public function rebuildGroupCache()
|
||||
{
|
||||
$cache = array();
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'groups',
|
||||
'order' => 'g_title ASC' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $i = $this->DB->fetch() )
|
||||
{
|
||||
$cache[ $i['g_id'] ] = IPSMember::unpackGroup( $i );
|
||||
}
|
||||
|
||||
$this->cache->setCache( 'group_cache', $cache, array( 'array' => 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,266 +0,0 @@
|
||||
<?
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2004 Invision Power Services, Inc
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > IP Chat => IPB Bridge Script
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: 17th February 2003 (Updated: 1 July 2004)
|
||||
| > Updated for 2.1.x: Thu 6th October 2005
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* SIGMACHAT auth file.
|
||||
*
|
||||
* Set-up and load module to run
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @author Matt Mecham
|
||||
* @version 2.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script type
|
||||
*
|
||||
*/
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
|
||||
require_once( './init.php' );
|
||||
|
||||
//===========================================================================
|
||||
// MAIN PROGRAM
|
||||
//===========================================================================
|
||||
|
||||
$INFO = array();
|
||||
|
||||
//--------------------------------
|
||||
// Load our classes
|
||||
//--------------------------------
|
||||
|
||||
require_once ROOT_PATH . "sources/ipsclass.php";
|
||||
require_once KERNEL_PATH . "class_converge.php";
|
||||
require_once ROOT_PATH . "conf_global.php";
|
||||
|
||||
# Initiate super-class
|
||||
$ipsclass = new ipsclass();
|
||||
$ipsclass->vars = $INFO;
|
||||
|
||||
//--------------------------------
|
||||
// The clocks a' tickin'
|
||||
//--------------------------------
|
||||
|
||||
$Debug = new Debug;
|
||||
$Debug->startTimer();
|
||||
|
||||
//--------------------------------
|
||||
// Load the DB driver and such
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->init_db_connection();
|
||||
|
||||
//--------------------------------
|
||||
// Set up our vars
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->parse_incoming();
|
||||
|
||||
//--------------------------------
|
||||
// Set converge
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->converge = new class_converge( $ipsclass->DB );
|
||||
|
||||
//--------------------------------
|
||||
// Start off the cache array
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->cache_array = array('rss_calendar', 'rss_export','components','banfilters', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats', 'languages');
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Get cache...
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->init_load_cache( $ipsclass->cache_array );
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->initiate_ipsclass();
|
||||
|
||||
//===========================================================================
|
||||
// AUTHORIZE...
|
||||
//===========================================================================
|
||||
|
||||
define( 'DENIED', 0 );
|
||||
define( 'ACCESS', 1 );
|
||||
define( 'ADMIN' , 2 );
|
||||
|
||||
$allowed_groups = $ipsclass->vars['chat_admin_groups'];
|
||||
$access_groups = $ipsclass->vars['chat_access_groups'];
|
||||
$autologin = 0;
|
||||
$allow_guest_access = $ipsclass->vars['chat_allow_guest'] == 1 ? ACCESS : DENIED;
|
||||
|
||||
// Stupid PHP changing it's mind on HTTP args
|
||||
|
||||
$username = $_GET['username'] != "" ? $_GET['username'] : $HTTP_GET_VARS['username'];
|
||||
$password = $_GET['password'] != "" ? $_GET['password'] : $HTTP_GET_VARS['password'];
|
||||
$ip = $_GET['ip'] != "" ? $_GET['ip'] : $HTTP_GET_VARS['ip'];
|
||||
|
||||
//----------------------------------------------
|
||||
// Test for autologin.
|
||||
//----------------------------------------------
|
||||
|
||||
if ( preg_match( "/^(?:[0-9a-z]){32}$/", $password ) )
|
||||
{
|
||||
$autologin = 1;
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// Remove URL encoding (%20, etc)
|
||||
//----------------------------------------------
|
||||
|
||||
$username = $ipsclass->parse_clean_value(urldecode(trim($username)));
|
||||
$password = $ipsclass->parse_clean_value(urldecode(trim($password)));
|
||||
$ip = $ipsclass->parse_clean_value(urldecode(trim($ip)));
|
||||
|
||||
//----------------------------------------------
|
||||
// Main code
|
||||
//----------------------------------------------
|
||||
|
||||
// Start off with the lowest accessibility
|
||||
|
||||
$output_int = $allow_guest_access;
|
||||
$output_name = "";
|
||||
|
||||
//------------------------------
|
||||
// Attempt to find the user
|
||||
//------------------------------
|
||||
|
||||
$ipsclass->DB->build_query( array( 'select' => 'm.mgroup, m.name, m.members_display_name, m.id, c.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.members_l_display_name='".$ipsclass->DB->add_slashes(strtolower($username))."'",
|
||||
'limit' => array( 0, 1 ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'from' => array( 'members_converge' => 'c' ),
|
||||
'where' => 'c.converge_email=m.email',
|
||||
) )
|
||||
) );
|
||||
$ipsclass->DB->exec_query();
|
||||
|
||||
|
||||
if ( ! $member = $ipsclass->DB->fetch_row() )
|
||||
{
|
||||
die_nice();
|
||||
|
||||
//-- script exits --//
|
||||
}
|
||||
|
||||
|
||||
if ( ! $member['id'] )
|
||||
{
|
||||
// No member found - allow guest access?
|
||||
|
||||
die_nice($allow_guest_access);
|
||||
|
||||
//-- script exits --//
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
// Update passy
|
||||
//------------------------------
|
||||
|
||||
if ( ! $autologin )
|
||||
{
|
||||
$md5_password = md5( md5( $member['converge_pass_salt'] ) . md5($password) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$md5_password = $password;
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
// Check password - member exists
|
||||
//------------------------------
|
||||
|
||||
if ( $password != "" )
|
||||
{
|
||||
// Password was entered..
|
||||
|
||||
if ( $md5_password != $member['converge_pass_hash'] )
|
||||
{
|
||||
// Password incorrect..
|
||||
|
||||
die_nice();
|
||||
|
||||
//-- script exits --//
|
||||
}
|
||||
else
|
||||
{
|
||||
$output_int = ACCESS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No password entered - die!
|
||||
// Do not allow guest access on reg. name
|
||||
|
||||
die_nice();
|
||||
|
||||
//-- script exits --//
|
||||
}
|
||||
|
||||
|
||||
//------------------------------
|
||||
// Do we have any access?
|
||||
//------------------------------
|
||||
|
||||
|
||||
if ( ! preg_match( "/(^|,)".$member['mgroup']."(,|$)/", $access_groups ) )
|
||||
{
|
||||
die_nice();
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
// Do we have admin access?
|
||||
//------------------------------
|
||||
|
||||
if ( preg_match( "/(^|,)".$member['mgroup']."(,|$)/", $allowed_groups ) )
|
||||
{
|
||||
$output_int = ADMIN;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------
|
||||
// Spill the beans
|
||||
//------------------------------
|
||||
|
||||
print "SCRAS^1.1\nAUTH^".$output_int."\nUID^".intval($member['id'])."\n";
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
function die_nice( $access=0 )
|
||||
{
|
||||
global $ipsclass;
|
||||
|
||||
// Simply error out silently, showing guest access only for the user
|
||||
$ipsclass->DB->close_db();
|
||||
print $access;
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,268 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Rebuilds stuff from XML
|
||||
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'admin' );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IP.Board Shell Rebuild Stuff From XML Tool\n--------------------------------------------\n" );
|
||||
$this->_print( "What do you wish to do? [l=Rebuild Lang, s=Rebuild Skins, b=Both]\nEnter: " );
|
||||
|
||||
$option = $this->_fetchOption();
|
||||
|
||||
switch( $option )
|
||||
{
|
||||
case 'l':
|
||||
$this->_doLang();
|
||||
break;
|
||||
case 's':
|
||||
$this->_doSkins();
|
||||
break;
|
||||
case 'b':
|
||||
$this->_doLang();
|
||||
$this->_doSkins();
|
||||
break;
|
||||
default:
|
||||
$this->_print( "\nIncorrect option" );
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild langs
|
||||
*/
|
||||
protected function _doSkins()
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$output = array();
|
||||
$errors = array();
|
||||
|
||||
/* Grab class */
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinImportExport.php' );/*noLibHook*/
|
||||
|
||||
$skinFunctions = new skinImportExport( $this->registry );
|
||||
|
||||
|
||||
/* Grab skin data */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'skin_collections' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
/* Bit of jiggery pokery... */
|
||||
if ( $row['set_key'] == 'default' )
|
||||
{
|
||||
$row['set_key'] = 'root';
|
||||
$row['set_id'] = 0;
|
||||
}
|
||||
|
||||
$skinSets[ $row['set_key'] ] = $row;
|
||||
}
|
||||
|
||||
/* Templates */
|
||||
foreach( ipsRegistry::$applications as $appDir => $appData )
|
||||
{
|
||||
foreach( $skinSets as $skinKey => $skinData )
|
||||
{
|
||||
$_PATH = IPSLib::getAppDir( $appDir ) . '/xml/';
|
||||
|
||||
$output[] = "Upgrading {$skinData['set_name']} for $appDir templates...";
|
||||
|
||||
if ( is_file( $_PATH . $appDir . '_' . $skinKey . '_templates.xml' ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Install
|
||||
//-----------------------------------------
|
||||
|
||||
$return = $skinFunctions->importTemplateAppXML( $appDir, $skinKey, $skinData['set_id'], TRUE );
|
||||
|
||||
$output[] = intval( $return['insertCount'] ) . " added, " . intval( $return['updateCount'] ) . " templates updated";
|
||||
}
|
||||
|
||||
if ( is_file( $_PATH . $appDir . '_' . $skinKey . '_css.xml' ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Install
|
||||
//-----------------------------------------
|
||||
|
||||
$return = $skinFunctions->importCSSAppXML( $appDir, $skinKey, $skinData['set_id'] );
|
||||
|
||||
$output[] = intval( $return['insertCount'] ) . " {$skinData['set_name']} CSS files inserted";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Replacements */
|
||||
foreach( $skinSets as $skinKey => $skinData )
|
||||
{
|
||||
if ( is_file( IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $skinKey . '.xml' ) )
|
||||
{
|
||||
$skinFunctions->importReplacementsXMLArchive( file_get_contents( IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $skinKey . '.xml' ), $skinKey );
|
||||
|
||||
$output[] = $skinKey . " replacements rebuilt";
|
||||
}
|
||||
}
|
||||
|
||||
/* reset ID */
|
||||
$skinSets['root']['set_id'] = 1;
|
||||
|
||||
/* Recache */
|
||||
foreach( $skinSets as $skinKey => $skinData )
|
||||
{
|
||||
$skinFunctions->rebuildPHPTemplates( $skinData['set_id'] );
|
||||
|
||||
if ( $skinFunctions->fetchErrorMessages() !== FALSE )
|
||||
{
|
||||
$output[] = implode( "<br />", $skinFunctions->fetchErrorMessages() );
|
||||
}
|
||||
|
||||
$skinFunctions->rebuildCSS( $skinData['set_id'] );
|
||||
|
||||
if ( $skinFunctions->fetchErrorMessages() !== FALSE )
|
||||
{
|
||||
$output[] = implode( "<br />", $skinFunctions->fetchErrorMessages() );
|
||||
}
|
||||
|
||||
$skinFunctions->rebuildReplacementsCache( $skinData['set_id'] );
|
||||
|
||||
if ( $skinFunctions->fetchErrorMessages() !== FALSE )
|
||||
{
|
||||
$output[] = implode( "<br />", $skinFunctions->fetchErrorMessages() );
|
||||
}
|
||||
|
||||
$output[] = $skinKey . " recached";
|
||||
}
|
||||
|
||||
/* recache other */
|
||||
$skinFunctions->rebuildSkinSetsCache();
|
||||
|
||||
$this->_print( implode( "\n", $output ) );
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "COMPLETE. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild langs
|
||||
*/
|
||||
protected function _doLang()
|
||||
{
|
||||
/* Grab class */
|
||||
require_once( IPS_ROOT_PATH . 'applications/core/modules_admin/languages/manage_languages.php' );/*noLibHook*/
|
||||
$lang = new admin_core_languages_manage_languages( $this->registry );
|
||||
$lang->makeRegistryShortcuts( $this->registry );
|
||||
|
||||
$start = time();
|
||||
|
||||
foreach( ipsRegistry::$applications as $app => $app_data )
|
||||
{
|
||||
$output[] = "Upgrading ADMIN languages...";
|
||||
$_PATH = IPSLib::getAppDir( $app ) . '/xml/';
|
||||
|
||||
/* Loop through the xml directory and look for lang packs */
|
||||
try
|
||||
{
|
||||
foreach( new DirectoryIterator( $_PATH ) as $f )
|
||||
{
|
||||
if( preg_match( "#(admin|public)_(.+?)_language_pack.xml#", $f->getFileName() ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Import and cache
|
||||
//-----------------------------------------
|
||||
|
||||
$output[] = "Importing " . $f->getFileName();
|
||||
|
||||
$this->request['file_location'] = $_PATH . $f->getFileName();
|
||||
$lang->imprtFromXML( true, true, true, $app );
|
||||
}
|
||||
}
|
||||
} catch ( Exception $e ) {}
|
||||
}
|
||||
|
||||
$this->_print( implode( "\n", $output ) );
|
||||
$this->_print( "\nAll languages imported and recached" );
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "\COMPLETE. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,266 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Main public executable wrapper.
|
||||
* Set-up and load module to run
|
||||
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'admin' );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
/* Ensure it's CLI */
|
||||
$cli = php_sapi_name() === 'cli';
|
||||
|
||||
if ( ! $cli )
|
||||
{
|
||||
print "<html><head><title>Warning</title></head>\n";
|
||||
print "<body style='text-align:center'>\n";
|
||||
print "This script is meant to be run via command line<br />\n";
|
||||
print "More information:<br />\n";
|
||||
print "<a href=\"http://www.google.com/search?hl=en&q=php+cli+windows\" target=\"_blank\">http://www.google.com/search?hl=en&q=php+cli+windows</a><br />\n";
|
||||
print "This script will not run through a webserver.<br />\n";
|
||||
print "</body></html>\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
print "\n ";
|
||||
print "\n (_) _ __ ____ ";
|
||||
print "\n | || '_ \ / ___' ";
|
||||
print "\n | || |_) | \__. ";
|
||||
print "\n | || .__/.\___ \ ";
|
||||
print "\n |_||_| |_______/ \n\n";
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
/* Gallery Object */
|
||||
require_once( IPSLib::getAppDir('gallery') . '/sources/classes/gallery.php' );/*noLibHook*/
|
||||
$registry->setClass( 'gallery', new ipsGallery( $registry ) );
|
||||
|
||||
$this->albums = $this->registry->gallery->helper('albums');
|
||||
$this->images = $this->registry->gallery->helper('image');
|
||||
$this->moderate = $this->registry->gallery->helper('moderate');
|
||||
|
||||
/* Load up gallery boyo */
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IP.Gallery Rebuild Tool\n--------------------------------------------\n" );
|
||||
$this->_print( "[0] Rebuild All Albums Node Data (Node level, left and right indexes)" );
|
||||
$this->_print( "[1] Rebuild Album Data (Cover image, comment counts, etc)" );
|
||||
$this->_print( "[2] Rebuild Album Permissions (Ensures inherited permissions are OK)" );
|
||||
$this->_print( "[3] Rebuild Image File Data (Thumbnail images, etc)" );
|
||||
$this->_print( "[4] Rebuild Image SEO Data" );
|
||||
|
||||
$this->_print( "Enter Choice: ", "" );
|
||||
|
||||
$option = $this->_fetchOption();
|
||||
|
||||
if ( stristr( $option, 'look' ) )
|
||||
{
|
||||
$this->_print("\nYou see a forest full of shadows. In the distance smoke rises from a small building. There is a troll here." );
|
||||
exit;
|
||||
}
|
||||
|
||||
switch( $option )
|
||||
{
|
||||
case 0:
|
||||
$this->_albumNodes();
|
||||
break;
|
||||
case 1:
|
||||
$this->_albumData();
|
||||
break;
|
||||
case 2:
|
||||
$this->_albumPermissions();
|
||||
break;
|
||||
case 3:
|
||||
$this->_images();
|
||||
break;
|
||||
case 4:
|
||||
$this->_seoImages();
|
||||
break;
|
||||
case 99:
|
||||
$this->_print("\n100!");
|
||||
break;
|
||||
default:
|
||||
$this->_print("\nThat wasn't a real option and I strongly believe you knew that");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild All Nodes
|
||||
*/
|
||||
protected function _albumNodes()
|
||||
{
|
||||
$this->albums->rebuildNodeTree();
|
||||
|
||||
$this->_print("Node Tree rebuilt");
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild All Permissions
|
||||
*/
|
||||
protected function _albumPermissions()
|
||||
{
|
||||
$this->moderate->resetPermissions(0);
|
||||
|
||||
$this->_print("Permissions rebuilt");
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild All Album Data
|
||||
*/
|
||||
protected function _albumData()
|
||||
{
|
||||
$done = 0;
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'gallery_albums_main',
|
||||
'where' => '1=1' ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$done++;
|
||||
$this->albums->resync( $row );
|
||||
}
|
||||
|
||||
$this->_print("Album Data rebuilt");
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild Images
|
||||
*/
|
||||
protected function _images()
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$done = 0;
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'gallery_images',
|
||||
'order' => 'id ASC' ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$done++;
|
||||
|
||||
$this->images->resync( $row );
|
||||
$this->images->buildSizedCopies( $row );
|
||||
|
||||
if ( $done % 50 == 0 )
|
||||
{
|
||||
$this->_print( "Completed... " . $done . " (IMG ID=" . $row['id'] . " total=" . ( $done ) . ")" );
|
||||
}
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
}
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "Finished Images. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild Images
|
||||
*/
|
||||
protected function _seoImages()
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$done = 0;
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'gallery_images',
|
||||
'order' => 'id ASC' ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$done++;
|
||||
|
||||
$this->DB->update( 'gallery_images', array( 'caption_seo' => IPSText::makeSeoTitle( $row['caption'] ) ), 'id=' . $row['id'] );
|
||||
|
||||
if ( $done % 50 == 0 )
|
||||
{
|
||||
$this->_print( "Completed... " . $done . " (IMG ID=" . $row['id'] . " total=" . ( $done ) . ")" );
|
||||
}
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
}
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "Finished Images. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
@@ -0,0 +1,122 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Main public executable wrapper.
|
||||
* Set-up and load module to run
|
||||
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IP.Gallery Images SEO Fixer\n--------------------------------------------\n" );
|
||||
$this->_print( "Start from row?\nEnter: " );
|
||||
|
||||
$start = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_print( "Do X rows\nEnter: " );
|
||||
|
||||
$end = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_doImages( $start, $end );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild Images
|
||||
*/
|
||||
protected function _doImages( $_start, $end )
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$done = 0;
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'gallery_images',
|
||||
'order' => 'id ASC',
|
||||
'limit' => array( $_start, $end ) ) );
|
||||
|
||||
$t = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $t ) )
|
||||
{
|
||||
$this->DB->update( 'gallery_images', array( 'caption_seo' => IPSText::makeSeoTitle( $row['caption'] ) ), 'id=' . $row['id'] );
|
||||
$done++;
|
||||
|
||||
if ( $done % 250 == 0 )
|
||||
{
|
||||
$this->_print( "Completed... " . $done . " (IMG ID=" . $row['file_id'] . " total=" . ( $_start + $done ) . ")" );
|
||||
}
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
}
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "FINISHED Images. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
@@ -0,0 +1,326 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Main public executable wrapper.
|
||||
* Set-up and load module to run
|
||||
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPS_CLI_MEMORY_DEBUG', false );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
protected $processed = 0;
|
||||
protected $start = 0;
|
||||
protected $end = 0;
|
||||
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->memberData = array();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IP.Board PM Re-Builder\n--------------------------------------------\n" );
|
||||
|
||||
$this->_print( "Start at row (Enter 0 to start from the very first entry)\nEnter: " );
|
||||
|
||||
$this->start = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_print( "Process X rows (Enter 0 to process all rows)\nEnter: " );
|
||||
|
||||
$this->end = intval( $this->_fetchOption() );
|
||||
|
||||
if ( $this->start == 0 )
|
||||
{
|
||||
$this->_print( "No starting ID? Do you want to remove all current PMs to start again? (y/n): " );
|
||||
|
||||
$delete = $this->_fetchOption();
|
||||
|
||||
if ( $delete == 'y' )
|
||||
{
|
||||
/* Ditch current data */
|
||||
$this->DB->delete( 'message_posts' );
|
||||
$this->DB->delete( 'message_topics' );
|
||||
$this->DB->delete( 'message_topic_user_map' );
|
||||
}
|
||||
}
|
||||
|
||||
while( ( $result = $this->_process() ) !== FALSE )
|
||||
{
|
||||
$this->_print( $result );
|
||||
}
|
||||
|
||||
/* We're done.. */
|
||||
$this->_print( "COMPLETE" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually process it
|
||||
*/
|
||||
protected function _process()
|
||||
{
|
||||
if ( ! $this->end OR ( $this->end > $this->processed ) )
|
||||
{
|
||||
/* More to do... */
|
||||
$batch = 250;
|
||||
$_s = $this->processed + $this->start;
|
||||
$_e = ( $this->end AND $this->end < $batch ) ? $this->end : $batch;
|
||||
$this->processed = $_s + $batch;
|
||||
$this->start = 0;
|
||||
$converted = 0;
|
||||
$seen = 0;
|
||||
|
||||
/* Select max topic ID thus far */
|
||||
$_tmp = $this->DB->buildAndFetch( array( 'select' => 'MAX(mt_id) as max',
|
||||
'from' => 'message_topics' ) );
|
||||
|
||||
$topicID = intval( $_tmp['max'] );
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'message_text',
|
||||
'order' => 'msg_id ASC',
|
||||
'limit' => array( $_s, $_e ) ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $post = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$seen++;
|
||||
|
||||
/* Make sure all data is valid */
|
||||
if ( intval( $post['msg_sent_to_count'] ) < 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* a little set up */
|
||||
$oldTopics = array();
|
||||
|
||||
/* Now fetch all topics */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'message_topics_old',
|
||||
'where' => 'mt_msg_id=' . intval( $post['msg_id'] ) ) );
|
||||
|
||||
$t = $this->DB->execute();
|
||||
|
||||
while( $topic = $this->DB->fetch( $t ) )
|
||||
{
|
||||
/* Got any data? */
|
||||
if ( ! $topic['mt_from_id'] OR ! $topic['mt_to_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$oldTopics[ $topic['mt_id'] ] = $topic; # Luke added that space. That's his first contribution to the code vaults at IPS.
|
||||
}
|
||||
|
||||
/* Attempt to free memory */
|
||||
$this->DB->freeResult( $t );
|
||||
|
||||
/* Fail safe */
|
||||
if ( ! count( $oldTopics ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Increment number */
|
||||
$topicID++;
|
||||
|
||||
/* Add in the post */
|
||||
$this->DB->insert( 'message_posts', array( 'msg_topic_id' => $topicID,
|
||||
'msg_date' => $post['msg_date'],
|
||||
'msg_post' => $post['msg_post'],
|
||||
'msg_post_key' => $post['msg_post_key'],
|
||||
'msg_author_id' => $post['msg_author_id'],
|
||||
'msg_ip_address' => $post['msg_ip_address'],
|
||||
'msg_is_first_post' => 1 ) );
|
||||
$postID = $this->DB->getInsertId();
|
||||
|
||||
/* Update attachments */
|
||||
$this->DB->update( 'attachments', array( 'attach_rel_id' => $postID ), "attach_rel_module='msg' AND attach_rel_id=".$post['msg_id'] );
|
||||
|
||||
/* Define some stuff. "To" member is added last in IPB 2 */
|
||||
$_tmp = $oldTopics;
|
||||
ksort( $_tmp );
|
||||
$topicData = array_pop( $_tmp );
|
||||
$_invited = array();
|
||||
$_seenOwner = array();
|
||||
$_isDeleted = 0;
|
||||
|
||||
/* Add the member rows */
|
||||
foreach( $oldTopics as $mt_id => $data )
|
||||
{
|
||||
/* Prevent SQL error with unique index: Seen the owner ID already? */
|
||||
if ( $_seenOwner[ $data['mt_owner_id'] ] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$_seenOwner[ $data['mt_owner_id'] ] = $data['mt_owner_id'];
|
||||
|
||||
/* Build invited - does not include 'to' person */
|
||||
if ( $data['mt_owner_id'] AND ( $post['msg_author_id'] != $data['mt_owner_id'] ) AND ( $topicData['mt_to_id'] != $data['mt_owner_id'] ) )
|
||||
{
|
||||
$_invited[ $data['mt_owner_id'] ] = $data['mt_owner_id'];/*noLibHook*/
|
||||
}
|
||||
|
||||
$_isSent = ( $data['mt_vid_folder'] == 'sent' ) ? 1 : 0;
|
||||
$_isDraft = ( $data['mt_vid_folder'] == 'unsent' ) ? 1 : 0;
|
||||
|
||||
$this->DB->insert( 'message_topic_user_map', array( 'map_user_id' => $data['mt_owner_id'],
|
||||
'map_topic_id' => $topicID,
|
||||
'map_folder_id' => ( $_isDraft ) ? 'drafts' : 'myconvo',
|
||||
'map_read_time' => ( $data['mt_user_read'] ) ? $data['mt_user_read'] : ( $data['mt_read'] ? time() : 0 ),
|
||||
'map_user_active' => 1,
|
||||
'map_user_banned' => 0,
|
||||
'map_has_unread' => 0,//( $data['mt_read'] ) ? 0 : 1,
|
||||
'map_is_system' => 0,
|
||||
'map_last_topic_reply' => $post['msg_date'],
|
||||
'map_is_starter' => ( $data['mt_owner_id'] == $post['msg_author_id'] ) ? 1 : 0 ) );
|
||||
|
||||
}
|
||||
|
||||
/* Now, did we see the author? If not, add them too but as inactive */
|
||||
if ( ! $_seenOwner[ $post['msg_author_id'] ] )
|
||||
{
|
||||
$_isDeleted = 1;
|
||||
|
||||
/*$this->DB->insert( 'message_topic_user_map', array( 'map_user_id' => $post['msg_author_id'],
|
||||
'map_topic_id' => $topicID,
|
||||
'map_folder_id' => 'myconvo',
|
||||
'map_read_time' => 0,
|
||||
'map_user_active' => 0,
|
||||
'map_user_banned' => 0,
|
||||
'map_has_unread' => 0,
|
||||
'map_is_system' => 0,
|
||||
'map_is_starter' => 1 ) );*/
|
||||
}
|
||||
|
||||
$_isSent = ( $topicData['mt_vid_folder'] == 'sent' ) ? 1 : 0;
|
||||
$_isDraft = ( $topicData['mt_vid_folder'] == 'unsent' ) ? 1 : 0;
|
||||
|
||||
/* This is for MSSQL. I need a quick fix. This is it. Enjoy. */
|
||||
if ( method_exists( $this->DB, 'setTableIdentityInsert' ) )
|
||||
{
|
||||
$this->DB->setTableIdentityInsert( 'message_topics', 'ON' );
|
||||
}
|
||||
|
||||
/* Add the topic */
|
||||
$this->DB->insert( 'message_topics', array( 'mt_id' => $topicID,
|
||||
'mt_date' => $topicData['mt_date'],
|
||||
'mt_title' => $topicData['mt_title'],
|
||||
'mt_starter_id' => $post['msg_author_id'],
|
||||
'mt_start_time' => $post['msg_date'],
|
||||
'mt_last_post_time' => $post['msg_date'],
|
||||
'mt_invited_members' => serialize( array_keys( $_invited ) ),
|
||||
'mt_to_count' => count( array_keys( $_invited ) ) + 1,
|
||||
'mt_to_member_id' => $topicData['mt_to_id'],
|
||||
'mt_replies' => 0,
|
||||
'mt_last_msg_id' => $postID,
|
||||
'mt_first_msg_id' => $postID,
|
||||
'mt_is_draft' => $_isDraft,
|
||||
'mt_is_deleted' => $_isDeleted,
|
||||
'mt_is_system' => 0 ) );
|
||||
|
||||
/* This is for MSSQL. I need a quick fix. This is it. Enjoy. */
|
||||
if ( method_exists( $this->DB, 'setTableIdentityInsert' ) )
|
||||
{
|
||||
$this->DB->setTableIdentityInsert( 'message_topics', 'OFF' );
|
||||
}
|
||||
|
||||
$converted++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Attempt to free memory */
|
||||
$this->DB->freeResult( $o );
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
|
||||
/* Memory Debug */
|
||||
if ( IPS_CLI_MEMORY_DEBUG )
|
||||
{
|
||||
IPSDebug::setMemoryDebugFlag( "Done", 0 );
|
||||
|
||||
foreach( IPSDebug::$memory_debug as $i )
|
||||
{
|
||||
$this->_print( "Debug:... " . $i[0] . ' - ' . IPSLib::sizeFormat( $i[1] ) );
|
||||
}
|
||||
|
||||
/* Reset */
|
||||
IPSDebug::$memory_debug = array();
|
||||
}
|
||||
|
||||
if ( $seen )
|
||||
{
|
||||
/* Check for more.. */
|
||||
return "Checked {$seen}, Completed... " . $this->processed . "(last ID=[ " . $topicID . " ] )";
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,615 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Main public executable wrapper.
|
||||
* Set-up and load module to run
|
||||
* Last Updated: $Date: 2013-02-05 06:22:45 -0500 (Tue, 05 Feb 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: mmecham $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 11935 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPS_CLI_MEMORY_DEBUG', false );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
protected $processed = 0;
|
||||
protected $parser;
|
||||
protected $oldparser;
|
||||
protected $start = 0;
|
||||
protected $end = 0;
|
||||
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->memberData = array();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
//-----------------------------------------
|
||||
// Get new parser and old parser
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_ROOT_PATH . "sources/handlers/han_parse_bbcode.php" );/*noLibHook*/
|
||||
$this->parser = new parseBbcode( $this->registry );
|
||||
$this->oldparser = new parseBbcode( $this->registry, 'legacy' );
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );
|
||||
$this->newParser = new $classToLoad();
|
||||
|
||||
//-----------------------------------------
|
||||
// Show options
|
||||
//-----------------------------------------
|
||||
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IP.Board Post Content Re-Builder\n--------------------------------------------\n" );
|
||||
$this->_print( "What do you wish to build?\n(c=Calendar Events, a=Announcements, x=Personal Conversations, s=Signatures, m=About me, p=posts, o=Remove Orphaned Posts)\nEnter: " );
|
||||
|
||||
$option = $this->_fetchOption();
|
||||
|
||||
switch( $option )
|
||||
{
|
||||
case 'c':
|
||||
$this->_doPosts('cal');
|
||||
break;
|
||||
case 'a':
|
||||
$this->_doPosts('announce');
|
||||
break;
|
||||
case 'x':
|
||||
$this->_doPosts('pms');
|
||||
break;
|
||||
case 's':
|
||||
$this->_doPosts('sigs');
|
||||
break;
|
||||
case 'm':
|
||||
$this->_doPosts('aboutme');
|
||||
break;
|
||||
case 'p':
|
||||
$this->_doPosts('posts');
|
||||
break;
|
||||
case 'o':
|
||||
$this->_doOrphanedPosts();
|
||||
break;
|
||||
default:
|
||||
$this->_doPosts('posts');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild data
|
||||
*/
|
||||
protected function _doOrphanedPosts()
|
||||
{
|
||||
$batch = 250;
|
||||
$c = -1;
|
||||
$bucket = array();
|
||||
|
||||
/* Lets grab the highest and lowest IDs */
|
||||
$rows = $this->DB->buildAndFetch( array( 'select' => "count(pid) AS CNT, max(pid) AS MAX, min(pid) as MIN",
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 't.tid IS NULL',
|
||||
'add_join' => array( array( 'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id' ) ) ) );
|
||||
|
||||
if ( empty( $rows['CNT'] ) )
|
||||
{
|
||||
$this->_print( "No orphaned posts have been found" );
|
||||
exit();
|
||||
}
|
||||
|
||||
$this->DB->build( array( 'select' => 'pid, from_unixtime(post_date) as time',
|
||||
'from' => 'posts',
|
||||
'where' => 'pid IN( ' . $rows['MIN'] . ',' . $rows['MAX'] . ')' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$posts[ $r['pid'] ] = $r['time'];
|
||||
}
|
||||
|
||||
$this->_print( "--------------------------------------------\n" . $rows['CNT'] . " orphaned posts found\n--------------------------------------------\n" );
|
||||
$this->_print( "Oldest: PID:" . $rows['MIN'] . " - Date: " . $posts[ $rows['MIN'] ] );
|
||||
$this->_print( "Newest: PID:" . $rows['MAX'] . " - Date: " . $posts[ $rows['MAX'] ] );
|
||||
$this->_print( "Continue? (y/n):" );
|
||||
|
||||
$option = $this->_fetchOption();
|
||||
|
||||
if ( $option != 'y' )
|
||||
{
|
||||
$this->_print("Nothing deleted");
|
||||
exit();
|
||||
}
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums' );
|
||||
$this->modLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
/* Still here? */
|
||||
$this->DB->build( array( 'select' => "pid",
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 't.tid IS NULL',
|
||||
'add_join' => array( array( 'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id' ) ) ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $post = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$c++;
|
||||
|
||||
$bucket[] = $post['pid'];
|
||||
|
||||
if ( $c % $batch )
|
||||
{
|
||||
$this->modLibrary->postDeleteFromDb( $bucket, true, true );
|
||||
$this->_print( $c . ' deleted' );
|
||||
|
||||
//$this->_print( var_export( $bucket, true ) );
|
||||
|
||||
$bucket = array();
|
||||
$c = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_print( "All done" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild data
|
||||
*/
|
||||
protected function _doPosts( $type )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Set up
|
||||
//-----------------------------------------
|
||||
|
||||
$last = 0;
|
||||
$output = array();
|
||||
$types = array( 'posts', 'pms', 'cal', 'announce', 'sigs', 'aboutme' );
|
||||
$type = in_array( $type, $types ) ? $type : 'posts';
|
||||
$groupCache = $this->caches['group_cache'];
|
||||
|
||||
$this->_print( "Start at ID (Enter 0 to start from the very first entry)\nEnter: " );
|
||||
|
||||
$this->start = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_print( "Process X rows (Enter 0 to process all rows)\nEnter: " );
|
||||
|
||||
$this->end = intval( $this->_fetchOption() );
|
||||
|
||||
//-----------------------------------------
|
||||
// Process batches...
|
||||
//-----------------------------------------
|
||||
|
||||
while( ( $result = $this->_process( $type ) ) !== FALSE )
|
||||
{
|
||||
$this->_print( $result );
|
||||
}
|
||||
|
||||
/* We're done.. */
|
||||
$this->_print( "COMPLETE" );
|
||||
|
||||
/* Update isRebuilt cache */
|
||||
$sections = array();
|
||||
$alreadyRebuilt = $this->DB->buildAndFetch( array( 'select' => 'cs_value', 'from' => 'cache_store', 'where' => "cs_key='isRebuilt'" ) );
|
||||
|
||||
if( $alreadyRebuilt['cs_value'] )
|
||||
{
|
||||
$sections = explode( ',', $alreadyRebuilt['cs_value'] );
|
||||
}
|
||||
|
||||
$sections[] = $type;
|
||||
|
||||
$this->DB->replace( 'cache_store', array( 'cs_key' => 'isRebuilt', 'cs_value' => implode( ',', $sections ) ), array( "cs_key" ) );
|
||||
|
||||
/* Drop cache */
|
||||
if ( $type == 'posts' )
|
||||
{
|
||||
$this->DB->delete( 'content_cache_posts' );
|
||||
}
|
||||
else if ( $type == 'sigs' )
|
||||
{
|
||||
$this->DB->delete( 'content_cache_sigs' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually process
|
||||
*
|
||||
*/
|
||||
protected function _process( $type )
|
||||
{
|
||||
if ( $this->end == 0 OR ( $this->end > $this->processed ) )
|
||||
{
|
||||
/* More to do... */
|
||||
$batch = 250;
|
||||
$_s = intval( $this->start );
|
||||
$done = 0;
|
||||
$this->processed += $batch;
|
||||
|
||||
/* On mssql, the select query blocks all the updates. Doing this causes the engine not to lock */
|
||||
if ( method_exists( $this->DB, 'setQueryRowLocking' ) )
|
||||
{
|
||||
$this->DB->setQueryRowLocking( 'OFF' );
|
||||
}
|
||||
|
||||
switch( $type )
|
||||
{
|
||||
case 'cal':
|
||||
$this->DB->build( array( 'select' => 'e.*',
|
||||
'from' => array( 'cal_events' => 'e' ),
|
||||
'order' => 'e.event_id ASC',
|
||||
'where' => 'e.event_id > ' . $_s,
|
||||
'limit' => array( $batch ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.member_group_id, m.mgroup_others',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=e.event_member_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$this->DB->build( array( 'select' => 'a.*',
|
||||
'from' => array( 'announcements' => 'a' ),
|
||||
'order' => 'a.announce_id ASC',
|
||||
'where' => 'a.announce_id > ' . $_s,
|
||||
'limit' => array( $batch ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.member_group_id, m.mgroup_others',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=a.announce_member_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$this->DB->build( array( 'select' => 'p.*',
|
||||
'from' => array( 'message_posts' => 'p' ),
|
||||
'order' => 'p.msg_id ASC',
|
||||
'where' => 'p.msg_id > ' . $_s,
|
||||
'limit' => array( $batch ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.member_group_id, m.mgroup_others',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=p.msg_author_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$this->DB->build( array( 'select' => 'me.signature, me.pp_member_id',
|
||||
'from' => array( 'profile_portal' => 'me' ),
|
||||
'order' => 'me.pp_member_id ASC',
|
||||
'where' => "me.signature IS NOT NULL AND me.signature != '' AND me.pp_member_id > " . $_s,
|
||||
'limit' => array( $batch ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.member_group_id, m.mgroup_others, m.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=me.pp_member_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'aboutme':
|
||||
$this->DB->build( array( 'select' => 'pp.pp_about_me, pp.pp_member_id',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'order' => 'pp.pp_member_id ASC',
|
||||
'where' => "pp.pp_about_me != '' AND pp.pp_about_me IS NOT NULL AND pp.pp_member_id > " . $_s,
|
||||
'limit' => array( $batch ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.member_group_id, m.mgroup_others, m.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=pp.pp_member_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
$this->DB->build( array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'order' => 'p.pid ASC',
|
||||
'where' => 'p.pid > ' . $_s,
|
||||
'limit' => array( $batch ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 't.forum_id',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.tid=p.topic_id"
|
||||
),
|
||||
2 => array( 'type' => 'left',
|
||||
'select' => 'm.member_group_id, m.mgroup_others',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=p.author_id"
|
||||
),
|
||||
3 => array( 'type' => 'left',
|
||||
'select' => 'f.*',
|
||||
'from' => array( 'forums' => 'f' ),
|
||||
'where' => "t.forum_id=f.id"
|
||||
) ) ) );
|
||||
break;
|
||||
}
|
||||
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// Process...
|
||||
//-----------------------------------------
|
||||
|
||||
while( $r = $this->DB->fetch( $outer ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Reset
|
||||
//-----------------------------------------
|
||||
|
||||
$this->parser->quote_open = $this->oldparser->quote_open = 0;
|
||||
$this->parser->quote_closed = $this->oldparser->quote_closed = 0;
|
||||
$this->parser->quote_error = $this->oldparser->quote_error = 0;
|
||||
$this->parser->error = $this->oldparser->error = '';
|
||||
$this->parser->image_count = $this->oldparser->image_count = 0;
|
||||
$this->parser->parsing_mgroup = $this->oldparser->parsing_mgroup = $r['member_group_id'];
|
||||
$this->parser->parsing_mgroup_others = $this->oldparser->parsing_mgroup_others = $r['mgroup_others'];
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
|
||||
$this->memberData['g_bypass_badwords'] = $this->caches['group_cache'][ $r['member_group_id'] ]['g_bypass_badwords'];
|
||||
|
||||
switch( $type )
|
||||
{
|
||||
case 'cal':
|
||||
$this->parser->parse_smilies = $this->oldparser->parse_smilies = $r['event_smilies'];
|
||||
$this->parser->parse_html = $this->oldparser->parse_html = 0;
|
||||
$this->parser->parse_bbcode = $this->oldparser->parse_bbcode = 1;
|
||||
$this->parser->parsing_section = 'calendar';
|
||||
|
||||
$rawpost = $this->oldparser->preEditParse( $r['event_content'] );
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$this->parser->parse_smilies = $this->oldparser->parse_smilies = 1;
|
||||
$this->parser->parse_html = $this->oldparser->parse_html = $r['announce_html_enabled'];
|
||||
$this->parser->parse_bbcode = $this->oldparser->parse_bbcode = 1;
|
||||
$this->parser->parse_nl2br = $this->oldparser->parse_nl2br = $r['announce_nlbr_enabled'];
|
||||
$this->parser->parsing_section = 'announcement';
|
||||
|
||||
$rawpost = $this->oldparser->preEditParse( $r['announce_post'] );
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$this->parser->parse_smilies = $this->oldparser->parse_smilies = 1;
|
||||
$this->parser->parse_html = $this->oldparser->parse_html = $this->caches['group_cache'][ $r['member_group_id'] ]['g_dohtml'];
|
||||
$this->parser->parse_bbcode = $this->oldparser->parse_bbcode = 1;
|
||||
$this->parser->parse_nl2br = $this->oldparser->parse_nl2br = 1;
|
||||
$this->parser->parsing_section = 'pms';
|
||||
|
||||
$rawpost = $this->oldparser->preEditParse( $r['msg_post'] );
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$this->parser->parse_smilies = $this->oldparser->parse_smilies = 0;
|
||||
$this->parser->parse_html = $this->oldparser->parse_html = $this->caches['group_cache'][ $r['member_group_id'] ]['g_dohtml'];
|
||||
$this->parser->parse_bbcode = $this->oldparser->parse_bbcode = 1;
|
||||
$this->parser->parse_nl2br = $this->oldparser->parse_nl2br = 1;
|
||||
$this->parser->parsing_section = 'signatures';
|
||||
|
||||
$rawpost = $this->oldparser->preEditParse( $r['signature'] );
|
||||
break;
|
||||
|
||||
case 'aboutme':
|
||||
$this->parser->parse_smilies = $this->oldparser->parse_smilies = 1;
|
||||
$this->parser->parse_html = $this->oldparser->parse_html = $this->caches['group_cache'][ $r['member_group_id'] ]['g_dohtml'];
|
||||
$this->parser->parse_bbcode = $this->oldparser->parse_bbcode = 1;
|
||||
$this->parser->parse_nl2br = $this->oldparser->parse_nl2br = 1;
|
||||
$this->parser->parsing_section = 'aboutme';
|
||||
|
||||
$rawpost = $this->oldparser->preEditParse( $r['pp_about_me'] );
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
$allowHtml = ( $r['post_htmlstate'] && $r['use_html'] && $this->caches['group_cache'][ $r['member_group_id'] ]['g_dohtml'] );
|
||||
|
||||
$this->newParser->set( array( 'parseArea' => 'topics',
|
||||
'memberData' => $r,
|
||||
'parseBBCode' => $r['use_ibc'],
|
||||
'parseHtml' => $allowHtml,
|
||||
'parseEmoticons' => $r['use_emo'] ) );
|
||||
|
||||
$rawpost = $this->newParser->BBCodeToHtml( $r['post'] );
|
||||
break;
|
||||
}
|
||||
|
||||
/* @link http://community.invisionpower.com/tracker/issue-36434-rebuild-post-content-remove-break-from-post-content/ New parser retains <br>, legacy retains \n */
|
||||
if ( $type == 'posts' || $type == 'sigs' )
|
||||
{
|
||||
/* Anything special here? */
|
||||
$newpost = $rawpost;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( strstr( $rawpost, "\n" ) )
|
||||
{
|
||||
$rawpost = nl2br( $rawpost );
|
||||
}
|
||||
|
||||
$newpost = $this->parser->preDbParse( $rawpost );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove old \' escaping
|
||||
//-----------------------------------------
|
||||
|
||||
$newpost = str_replace( "\\'", "'", $newpost );
|
||||
|
||||
//-----------------------------------------
|
||||
// Convert old dohtml?
|
||||
//-----------------------------------------
|
||||
|
||||
$htmlstate = 0;
|
||||
|
||||
if ( strstr( strtolower($newpost), '[dohtml]' ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Can we use HTML?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'posts' AND $this->registry->class_forums->forum_by_id[ $r['forum_id'] ]['use_html'] )
|
||||
{
|
||||
$htmlstate = 2;
|
||||
}
|
||||
|
||||
$newpost = preg_replace( "#\[dohtml\]#i" , "", $newpost );
|
||||
$newpost = preg_replace( "#\[/dohtml\]#i", "", $newpost );
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmlstate = intval( $r['post_htmlstate'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Convert old attachment tags
|
||||
//-----------------------------------------
|
||||
|
||||
$newpost = preg_replace( "#\[attachmentid=(\d+?)\]#is", "[attachment=\\1:attachment]", $newpost );
|
||||
|
||||
if ( $newpost OR $type == 'sigs' OR $type == 'aboutme' )
|
||||
{
|
||||
switch( $type )
|
||||
{
|
||||
case 'posts':
|
||||
$this->DB->update( 'posts', array( 'post' => $newpost, 'post_htmlstate' => $htmlstate ), 'pid='.$r['pid'] );
|
||||
$string = substr( $r['post'], 0, 30 ) . '...';
|
||||
$last = $r['pid'];
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$this->DB->update( 'message_posts', array( 'msg_post' => $newpost ), 'msg_id='.$r['msg_id'] );
|
||||
$string = substr( $r['msg_post'], 0, 30 ) . '...';
|
||||
$last = $r['msg_id'];
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$this->DB->update( 'profile_portal', array( 'signature' => $newpost ), 'pp_member_id='.$r['pp_member_id'] );
|
||||
$string = substr( $r['members_display_name'], 0, 30 ) . '...';
|
||||
$last = $r['pp_member_id'];
|
||||
break;
|
||||
|
||||
case 'aboutme':
|
||||
$this->DB->update( 'profile_portal', array( 'pp_about_me' => $newpost ), 'pp_member_id='.$r['pp_member_id'] );
|
||||
$string = substr( $r['post'], 0, 30 ) . '...';
|
||||
$last = $r['pp_member_id'];
|
||||
break;
|
||||
|
||||
case 'cal':
|
||||
$this->DB->update( 'cal_events', array( 'event_content' => $newpost ), 'event_id='.$r['event_id'] );
|
||||
$string = substr( $r['event_content'], 0, 30 ) . '...';
|
||||
$last = $r['event_id'];
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$this->DB->update( 'announcements', array( 'announce_post' => $newpost ), 'announce_id='.$r['announce_id'] );
|
||||
$string = substr( $r['announce_post'], 0, 30 ) . '...';
|
||||
$last = $r['announce_id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unset( $r );
|
||||
$done++;
|
||||
}
|
||||
|
||||
if ( method_exists( $this->DB, 'setQueryRowLocking' ) )
|
||||
{
|
||||
$this->DB->setQueryRowLocking( 'ON' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Attempt to free memory */
|
||||
$this->DB->freeResult( $outer );
|
||||
|
||||
/* Memory Debug */
|
||||
if ( IPS_CLI_MEMORY_DEBUG )
|
||||
{
|
||||
IPSDebug::setMemoryDebugFlag( "Done", 0 );
|
||||
|
||||
foreach( IPSDebug::$memory_debug as $i )
|
||||
{
|
||||
$this->_print( "Debug:... " . $i[0] . ' - ' . IPSLib::sizeFormat( $i[1] ) );
|
||||
}
|
||||
|
||||
/* Reset */
|
||||
IPSDebug::$memory_debug = array();
|
||||
}
|
||||
|
||||
if ( $done )
|
||||
{
|
||||
$this->start = intval( $last );
|
||||
return "Completed... " . $this->processed . "(last ID[ " . $last . " ] " . str_replace( "\n", "", $string ) . ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,18 +0,0 @@
|
||||
-----------------------------------------------------
|
||||
IP.Board 2.3.0+ Rebuild Post Tool
|
||||
(c) Invision Power Services, Inc. 2007
|
||||
@author: Matt - June 2007
|
||||
-----------------------------------------------------
|
||||
OVERVIEW:
|
||||
This tool is run via command line to prevent the usual PHP timeout errors. It is also
|
||||
significantly quicker to run as it's capable of parsing up to 10,000 posts a minute.
|
||||
|
||||
USAGE:
|
||||
Simply upload the file 'rebuildposts.php' into your root IP.Board folder. This is the folder
|
||||
that contains your 'index.php' and 'init.php' files.
|
||||
|
||||
Log into your server via SSH, then Change Directory to your root IP.Board folder. Run the tool
|
||||
by typing: "php rebuildposts.php" (without the quotes).
|
||||
|
||||
Follow the onscreen prompts to select which type of post you wish to rebuild along with the
|
||||
starting ID you wish to use and how many posts you wish to rebuild.
|
||||
@@ -1,654 +0,0 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
|
||||
| http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2007-05-11 22:54:34 +0100 (Fri, 11 May 2007) $
|
||||
| > $Revision: 994 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > SHELL SCRIPT: Rebuild Posts
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script type
|
||||
*
|
||||
*/
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
|
||||
if ( ! file_exists( './init.php' ) )
|
||||
{
|
||||
myprint( "ERROR: This script MUST be placed in your forum's root directory.\n" );
|
||||
exit(0);
|
||||
}
|
||||
|
||||
require_once( './init.php' );
|
||||
|
||||
//===========================================================================
|
||||
// MAIN PROGRAM
|
||||
//===========================================================================
|
||||
|
||||
$INFO = array();
|
||||
|
||||
//--------------------------------
|
||||
// Load our classes
|
||||
//--------------------------------
|
||||
|
||||
require_once ROOT_PATH . "sources/ipsclass.php";
|
||||
require_once ROOT_PATH . "sources/classes/class_display.php";
|
||||
require_once ROOT_PATH . "sources/classes/class_session.php";
|
||||
require_once ROOT_PATH . "sources/classes/class_forums.php";
|
||||
require_once KERNEL_PATH . "class_converge.php";
|
||||
|
||||
if ( file_exists( ROOT_PATH . "conf_global.php" ) )
|
||||
{
|
||||
require_once ROOT_PATH . "conf_global.php";
|
||||
}
|
||||
|
||||
# Initiate super-class
|
||||
$ipsclass = new ipsclass();
|
||||
$ipsclass->vars = $INFO;
|
||||
|
||||
//--------------------------------
|
||||
// The clocks a' tickin'
|
||||
//--------------------------------
|
||||
|
||||
$Debug = new Debug;
|
||||
$Debug->startTimer();
|
||||
|
||||
//--------------------------------
|
||||
// Load the DB driver and such
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->init_db_connection();
|
||||
|
||||
//--------------------------------
|
||||
// Set debug mode
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->DB->set_debug_mode( 0 );
|
||||
|
||||
$ipsclass->forums = new forum_functions();
|
||||
$ipsclass->forums->ipsclass =& $ipsclass;
|
||||
|
||||
//--------------------------------
|
||||
// Set up our vars
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->parse_incoming();
|
||||
|
||||
//--------------------------------
|
||||
// Set converge
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->converge = new class_converge( $ipsclass->DB );
|
||||
|
||||
//--------------------------------
|
||||
// Start off the cache array
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->cache_array = array_merge( array('badwords','emoticons','attachtypes','bbcode', 'multimod','ranks','profilefields','skin_remap', 'rss_calendar', 'rss_export', 'components', 'banfilters', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats', 'languages') );
|
||||
|
||||
//===========================================================================
|
||||
// Get cache...
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->init_cache_setup();
|
||||
$ipsclass->init_load_cache( $ipsclass->cache_array );
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->initiate_ipsclass();
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the forums
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->forums->strip_invisible = 1;
|
||||
$ipsclass->forums->forums_init();
|
||||
|
||||
//--------------------------------
|
||||
// Load the skin
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->load_skin();
|
||||
|
||||
$ppu = 0;
|
||||
$tpu = 0;
|
||||
|
||||
if( isset($ipsclass->member['view_prefs']) )
|
||||
{
|
||||
list($ppu,$tpu) = explode( "&", $ipsclass->member['view_prefs'] );
|
||||
}
|
||||
|
||||
$ipsclass->vars['display_max_topics'] = ($tpu > 0) ? $tpu : $ipsclass->vars['display_max_topics'];
|
||||
$ipsclass->vars['display_max_posts'] = ($ppu > 0) ? $ppu : $ipsclass->vars['display_max_posts'];
|
||||
|
||||
//===========================================================================
|
||||
// Set up the session ID stuff
|
||||
//===========================================================================
|
||||
|
||||
if ( $ipsclass->session_type == 'cookie' )
|
||||
{
|
||||
$ipsclass->session_id = "";
|
||||
$ipsclass->base_url = $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'].'?';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ipsclass->base_url = $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'].'?s='.$ipsclass->session_id.'&';
|
||||
}
|
||||
|
||||
$ipsclass->js_base_url = $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'].'?s='.$ipsclass->session_id.'&';
|
||||
|
||||
//--------------------------------
|
||||
// Set up the forum_read cookie
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->hdl_forum_read_cookie();
|
||||
|
||||
//===========================================================================
|
||||
// Set up defaults
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->skin_id = $ipsclass->skin['_setid'];
|
||||
|
||||
$ipsclass->vars['img_url'] = $ipsclass->vars['ipb_img_url'] ? $ipsclass->vars['ipb_img_url'] . 'style_images/' . $ipsclass->skin['_imagedir'] : 'style_images/' . $ipsclass->skin['_imagedir'];
|
||||
$ipsclass->vars['AVATARS_URL'] = $ipsclass->vars['ipb_img_url'] ? $ipsclass->vars['ipb_img_url'] . 'style_avatars' : 'style_avatars';
|
||||
$ipsclass->vars['EMOTICONS_URL'] = $ipsclass->vars['ipb_img_url'] ? $ipsclass->vars['ipb_img_url'] . 'style_emoticons/<#EMO_DIR#>' : 'style_emoticons/<#EMO_DIR#>';
|
||||
$ipsclass->vars['mime_img'] = $ipsclass->vars['ipb_img_url'] ? $ipsclass->vars['ipb_img_url'] . 'style_images/<#IMG_DIR#>' : 'style_images/<#IMG_DIR#>';
|
||||
|
||||
//--------------------------------
|
||||
// Set up our language choice
|
||||
//--------------------------------
|
||||
|
||||
if ( !isset($ipsclass->vars['default_language']) OR $ipsclass->vars['default_language'] == "")
|
||||
{
|
||||
$ipsclass->vars['default_language'] = 'en';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load language
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->load_language('lang_global');
|
||||
|
||||
//-----------------------------------------
|
||||
// Continue
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
|
||||
$parser = new parse_bbcode();
|
||||
$parser->ipsclass =& $ipsclass;
|
||||
$parser->allow_update_caches = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Get input stream
|
||||
//-----------------------------------------
|
||||
|
||||
$stdin = fopen('php://stdin', 'r');
|
||||
|
||||
//-----------------------------------------
|
||||
// Ask what we're doing...
|
||||
//-----------------------------------------
|
||||
|
||||
myprint( "--------------------------------------------\nWelcome to the IP.Board Shell Post Rebuilder\n--------------------------------------------\nWhat do you wish to rebuild? [p=Posts, c=Calendar Events, m=Personal Messages, a=Announcements, s=Signatures]\nEnter: " );
|
||||
|
||||
$option = getoption();
|
||||
|
||||
//-----------------------------------------
|
||||
// What did we choose?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $option != 'p' AND $option != 'c' AND $option != 'm' AND $option != 'a' AND $option != 's' )
|
||||
{
|
||||
myprint( "Incorrect option chosen\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$type = '';
|
||||
|
||||
switch( $option )
|
||||
{
|
||||
case 'p':
|
||||
$type = 'posts';
|
||||
$human = 'Posts';
|
||||
break;
|
||||
case 'c':
|
||||
$type = 'cal';
|
||||
$human = 'Calendar Events';
|
||||
break;
|
||||
case 'm':
|
||||
$type = 'pms';
|
||||
$human = 'Personal Messages';
|
||||
break;
|
||||
case 's':
|
||||
$type = 'sigs';
|
||||
$human = 'Signatures';
|
||||
break;
|
||||
case 'a':
|
||||
$type = 'announce';
|
||||
$human = 'Announcements';
|
||||
break;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// CHOICE: Days or ID
|
||||
//-----------------------------------------
|
||||
|
||||
myprint( "You have selected to rebuild: " . $human . "\n--------------------------------------------\nDo you want to rebuild from the last X days items or start from a specific ID? [0=Rebuild from the beginning, d=Rebuild from last X days, n=Rebuild from an ID]\nEnter: " );
|
||||
|
||||
$option = getoption();
|
||||
|
||||
if ( $option == 'd' )
|
||||
{
|
||||
# DAYS
|
||||
myprint( "Enter the number of days to rebuild from [Entering 30 will rebuild all items from the past 30 days]:\nEnter: " );
|
||||
|
||||
$option = intval( getoption() );
|
||||
$date = 86400 * $option;
|
||||
$time = time() - $date;
|
||||
|
||||
# Find starting ID
|
||||
switch( $type )
|
||||
{
|
||||
case 'cal':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'event_id', 'from' => 'cal_events', 'where' => 'event_unixstamp >= ' . $time, 'limit' => array(1) ) );
|
||||
$max = intval( $tmp['event_id'] );
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'announce_id', 'from' => 'announcements', 'where' => 'announce_start >= ' . $time, 'limit' => array(1) ) );
|
||||
$max = intval( $tmp['announce_id'] );
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'msg_id', 'from' => 'message_text', 'where' => 'msg_date >= ' . $time, 'limit' => array(1) ) );
|
||||
$max = intval( $tmp['msg_id'] );
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'id', 'from' => 'member_extra', 'where' => "signature != '' AND joined >= " . $time, 'limit' => array(1) ) );
|
||||
$max = intval( $tmp['id'] );
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
default:
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'pid', 'from' => 'posts', 'where' => 'post_date >= ' . $time, 'limit' => array(1) ) );
|
||||
$max = intval( $tmp['pid'] );
|
||||
break;
|
||||
}
|
||||
|
||||
$start = $max;
|
||||
}
|
||||
else if ( $option == 'n' )
|
||||
{
|
||||
# Number
|
||||
myprint( "Enter the ID to start from:\nEnter: " );
|
||||
|
||||
$option = getoption();
|
||||
$start = intval( $option );
|
||||
}
|
||||
else
|
||||
{
|
||||
# All
|
||||
$start = 0;
|
||||
}
|
||||
|
||||
myprint( "Rebuilding {$human}, starting at ID " . $start . "\nRebuild how many? [Enter how many you'd like to rebuild. Hit enter to rebuild all]:\nEnter: " );
|
||||
|
||||
$option = getoption();
|
||||
|
||||
$end = ( $end > 0 ) ? intval( $end ) : 0;
|
||||
$done = 0;
|
||||
$_BATCH = 500;
|
||||
$_LAST_ID = intval( $start );
|
||||
$time_start = time();
|
||||
$COMPLETE = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Start the loop...
|
||||
//-----------------------------------------
|
||||
|
||||
while( $COMPLETE == 0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Got any more?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $type )
|
||||
{
|
||||
case 'cal':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'MAX(event_id) as max', 'from' => 'cal_events', 'where' => 'event_id > ' . $_LAST_ID ) );
|
||||
$max = intval( $tmp['max'] );
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'MAX(announce_id) as max', 'from' => 'announcements', 'where' => 'announce_id > ' . $_LAST_ID ) );
|
||||
$max = intval( $tmp['max'] );
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'MAX(msg_id) as max', 'from' => 'message_text', 'where' => 'msg_id > ' . $_LAST_ID ) );
|
||||
$max = intval( $tmp['max'] );
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'MAX(id) as max', 'from' => 'member_extra', 'where' => "signature != '' AND id > " . $_LAST_ID ) );
|
||||
$max = intval( $tmp['max'] );
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
default:
|
||||
$tmp = $ipsclass->DB->simple_exec_query( array( 'select' => 'MAX(pid) as max', 'from' => 'posts', 'where' => 'pid > ' . $_LAST_ID ) );
|
||||
$max = intval( $tmp['max'] );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ! $max OR $_LAST_ID > $max )
|
||||
{
|
||||
$COMPLETE = 1;
|
||||
}
|
||||
|
||||
myprint( "\nStarting batch: Last ID=" . $_LAST_ID . " Max ID=" . $max );
|
||||
|
||||
//-----------------------------------------
|
||||
// Avoid limit...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $type )
|
||||
{
|
||||
case 'cal':
|
||||
$ipsclass->DB->build_query( array( 'select' => 'e.*',
|
||||
'from' => array( 'cal_events' => 'e' ),
|
||||
'order' => 'e.event_id ASC',
|
||||
'where' => 'e.event_id > ' . $_LAST_ID,
|
||||
'limit' => array( $_BATCH ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.mgroup',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=e.event_member_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$ipsclass->DB->build_query( array( 'select' => 'a.*',
|
||||
'from' => array( 'announcements' => 'a' ),
|
||||
'order' => 'a.announce_id ASC',
|
||||
'where' => 'a.announce_id > ' . $_LAST_ID,
|
||||
'limit' => array( $_BATCH ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.mgroup',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=a.announce_member_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$ipsclass->DB->build_query( array( 'select' => 'p.*',
|
||||
'from' => array( 'message_text' => 'p' ),
|
||||
'order' => 'p.msg_id ASC',
|
||||
'where' => 'p.msg_id > ' . $_LAST_ID,
|
||||
'limit' => array( $_BATCH ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.mgroup',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=p.msg_author_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$ipsclass->DB->build_query( array( 'select' => 'me.signature, me.id',
|
||||
'from' => array( 'member_extra' => 'me' ),
|
||||
'order' => 'me.id ASC',
|
||||
'where' => "me.signature != '' AND me.id > " . $_LAST_ID,
|
||||
'limit' => array( $_BATCH ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 'm.mgroup',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=me.id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
default:
|
||||
$ipsclass->DB->build_query( array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid > ' . $_LAST_ID,
|
||||
'limit' => array( $_BATCH ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'select' => 't.forum_id',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.tid=p.topic_id"
|
||||
),
|
||||
2 => array( 'type' => 'left',
|
||||
'select' => 'm.mgroup',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=p.author_id"
|
||||
) )
|
||||
) );
|
||||
break;
|
||||
}
|
||||
|
||||
$outer = $ipsclass->DB->exec_query();
|
||||
|
||||
//-----------------------------------------
|
||||
// Process...
|
||||
//-----------------------------------------
|
||||
|
||||
while( $r = $ipsclass->DB->fetch_row( $outer ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Reset time limit
|
||||
//-----------------------------------------
|
||||
|
||||
@set_time_limit( 0 );
|
||||
|
||||
$parser->quote_open = 0;
|
||||
$parser->quote_closed = 0;
|
||||
$parser->quote_error = 0;
|
||||
$parser->error = '';
|
||||
$parser->image_count = 0;
|
||||
|
||||
$ipsclass->member['g_bypass_badwords'] = $ipsclass->cache['group_cache'][ $r['mgroup'] ]['g_bypass_badwords'];
|
||||
|
||||
switch( $type )
|
||||
{
|
||||
case 'cal':
|
||||
$parser->parse_smilies = $r['event_smilies'];
|
||||
$parser->parse_html = 0;
|
||||
$parser->parse_bbcode = 1;
|
||||
|
||||
$rawpost = $parser->pre_edit_parse( $r['event_content'] );
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$parser->parse_smilies = 1;
|
||||
$parser->parse_html = $r['announce_html_enabled'];
|
||||
$parser->parse_nl2br = 1;
|
||||
$parser->parse_bbcode = 1;
|
||||
|
||||
$rawpost = $parser->pre_edit_parse( $r['announce_post'] );
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$parser->parse_smilies = 1;
|
||||
$parser->parse_nl2br = 1;
|
||||
$parser->parse_html = $ipsclass->vars['msg_allow_html'];
|
||||
$parser->parse_bbcode = $ipsclass->vars['msg_allow_code'];
|
||||
|
||||
$rawpost = $parser->pre_edit_parse( $r['msg_post'] );
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$parser->parse_smilies = 0;
|
||||
$parser->parsing_signature = 1;
|
||||
$parser->parse_html = $ipsclass->vars['sig_allow_html'];
|
||||
$parser->parse_bbcode = $ipsclass->vars['sig_allow_ibc'];
|
||||
|
||||
$rawpost = $parser->pre_edit_parse( $r['signature'] );
|
||||
break;
|
||||
|
||||
case 'posts':
|
||||
default:
|
||||
$parser->parse_smilies = $r['use_emo'];
|
||||
$parser->parse_html = ( $ipsclass->cache['forum_cache'][ $r['forum_id'] ]['use_html'] AND
|
||||
$ipsclass->cache['group_cache'][ $r['mgroup'] ]['g_dohtml'] ) ? 1 : 0;
|
||||
$parser->parse_bbcode = $ipsclass->cache['forum_cache'][ $r['forum_id'] ]['use_ibc'];
|
||||
|
||||
$rawpost = $parser->pre_edit_parse( $r['post'] );
|
||||
break;
|
||||
}
|
||||
|
||||
$newpost = $parser->pre_db_parse( $rawpost );
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove old \' escaping
|
||||
//-----------------------------------------
|
||||
|
||||
$newpost = str_replace( "\\'", "'", $newpost );
|
||||
|
||||
//-----------------------------------------
|
||||
// Convert old dohtml?
|
||||
//-----------------------------------------
|
||||
|
||||
$htmlstate = 0;
|
||||
|
||||
if ( strstr( strtolower($newpost), '[dohtml]' ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Can we use HTML?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'posts' AND $ipsclass->cache['forum_cache'][ $r['forum_id'] ]['use_html'] )
|
||||
{
|
||||
$htmlstate = 2;
|
||||
}
|
||||
|
||||
$newpost = preg_replace( "#\[dohtml\]#i" , "", $newpost );
|
||||
$newpost = preg_replace( "#\[/dohtml\]#i", "", $newpost );
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmlstate = intval( $r['post_htmlstate'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Convert old attachment tags
|
||||
//-----------------------------------------
|
||||
|
||||
$newpost = preg_replace( "#\[attachmentid=(\d+?)\]#is", "[attachment=\\1:attachment]", $newpost );
|
||||
|
||||
$newpost = $parser->pre_display_parse( $newpost );
|
||||
|
||||
if ( $newpost OR $type == 'sigs' )
|
||||
{
|
||||
switch( $type )
|
||||
{
|
||||
case 'posts':
|
||||
$ipsclass->DB->do_update( 'posts', array( 'post' => $newpost, 'post_htmlstate' => $htmlstate ), 'pid='.$r['pid'] );
|
||||
$string = substr( $r['post'], 0, 30 ) . '...';
|
||||
$last = $r['pid'];
|
||||
break;
|
||||
|
||||
case 'pms':
|
||||
$ipsclass->DB->do_update( 'message_text', array( 'msg_post' => $newpost ), 'msg_id='.$r['msg_id'] );
|
||||
$string = substr( $r['msg_post'], 0, 30 ) . '...';
|
||||
$last = $r['msg_id'];
|
||||
break;
|
||||
|
||||
case 'sigs':
|
||||
$ipsclass->DB->do_update( 'member_extra', array( 'signature' => $newpost ), 'id='.$r['id'] );
|
||||
$string = $r['members_display_name'];
|
||||
$last = $r['id'];
|
||||
break;
|
||||
|
||||
case 'cal':
|
||||
$ipsclass->DB->do_update( 'cal_events', array( 'event_content' => $newpost ), 'event_id='.$r['event_id'] );
|
||||
$string = substr( $r['event_content'], 0, 30 ) . '...';
|
||||
$last = $r['event_id'];
|
||||
break;
|
||||
|
||||
case 'announce':
|
||||
$ipsclass->DB->do_update( 'announcements', array( 'announce_post' => $newpost ), 'announce_id='.$r['announce_id'] );
|
||||
$string = substr( $r['announce_post'], 0, 30 ) . '...';
|
||||
$last = $r['announce_id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Clear out DB cached queries
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->DB->obj['cached_queries'] = array();
|
||||
|
||||
$done++;
|
||||
$_LAST_ID = $last;
|
||||
|
||||
myprint( "[ID:" . $last . '] ' . $string );
|
||||
|
||||
if ( $end > 0 AND $done > $end )
|
||||
{
|
||||
$COMPLETE = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$time_end = time();
|
||||
|
||||
$time_taken = ( $time_end - $time_start) / 60;
|
||||
|
||||
myprint( "\nALL DONE! ($done rebuilt)" );
|
||||
myprint( "Time Taken: $time_taken minutes" );
|
||||
|
||||
@fclose( $stdin );
|
||||
exit(0);
|
||||
|
||||
//-----------------------------------------
|
||||
// My get
|
||||
//-----------------------------------------
|
||||
|
||||
function getoption()
|
||||
{
|
||||
global $stdin;
|
||||
//$stdin = fopen('php://stdin', 'r');
|
||||
$option = trim( fgets( $stdin ) );
|
||||
//fclose( $stdin );
|
||||
|
||||
return $option;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// FUNC: Write out
|
||||
//-----------------------------------------
|
||||
|
||||
function myprint( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,162 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Main public executable wrapper.
|
||||
* Set-up and load module to run
|
||||
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IP.Board IP.Downloads SEO Fixer\n--------------------------------------------\n" );
|
||||
$this->_print( "Start from row?\nEnter: " );
|
||||
|
||||
$start = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_print( "Do X rows\nEnter: " );
|
||||
|
||||
$end = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_doCats();
|
||||
$this->_doFiles( $start, $end );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild categories
|
||||
*/
|
||||
protected function _doCats()
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$done = 0;
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'downloads_categories',
|
||||
//'limit' => array( $_start, $end ) //those variables are always null
|
||||
) );
|
||||
|
||||
$t = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $t ) )
|
||||
{
|
||||
$title_seo = IPSText::makeSeoTitle( $row['cname'] );
|
||||
|
||||
$this->DB->update( 'downloads_categories', array( 'cname_furl' => $title_seo ), 'cid=' . $row['cid'] );
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
}
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "FINISHED CATEGORIES. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild langs
|
||||
*/
|
||||
protected function _doFiles( $_start, $end )
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$done = 0;
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'downloads_files',
|
||||
'order' => 'file_id ASC',
|
||||
'limit' => array( $_start, $end ) ) );
|
||||
|
||||
$t = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $t ) )
|
||||
{
|
||||
$title_seo = IPSText::makeSeoTitle( $row['file_name'] );
|
||||
|
||||
$this->DB->update( 'downloads_files', array( 'file_name_furl' => $title_seo ), 'file_id=' . $row['file_id'] );
|
||||
|
||||
$done++;
|
||||
|
||||
if ( $done % 250 == 0 )
|
||||
{
|
||||
$this->_print( "Completed... " . $done . " (File ID=" . $row['file_id'] . " total=" . ( $_start + $done ) . ")" );
|
||||
}
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
}
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "FINISHED FILES. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,148 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Main public executable wrapper.
|
||||
* Set-up and load module to run
|
||||
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IP.Gallery Albums and Categories SEO Fixer\n--------------------------------------------\n" );
|
||||
$this->_print( "Start from row?\nEnter: " );
|
||||
|
||||
$start = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_print( "Do X rows\nEnter: " );
|
||||
|
||||
$end = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_doCats();
|
||||
$this->_doAlbums( $start, $end );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild categories
|
||||
*/
|
||||
protected function _doCats()
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$done = 0;
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'gallery_categories' ) );
|
||||
$t = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $t ) )
|
||||
{
|
||||
$this->DB->update( 'gallery_categories', array( 'name_seo' => IPSText::makeSeoTitle( $row['name'] ) ), 'id=' . $row['id'] );
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
}
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "FINISHED CATEGORIES. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild Images
|
||||
*/
|
||||
protected function _doAlbums( $_start, $end )
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$done = 0;
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'gallery_albums',
|
||||
'order' => 'id ASC',
|
||||
'limit' => array( $_start, $end ) ) );
|
||||
|
||||
$t = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $t ) )
|
||||
{
|
||||
$this->DB->update( 'gallery_albums', array( 'name_seo' => IPSText::makeSeoTitle( $row['seo'] ) ), 'id=' . $row['id'] );
|
||||
$done++;
|
||||
|
||||
if ( $done % 250 == 0 )
|
||||
{
|
||||
$this->_print( "Completed... " . $done . " (Album ID=" . $row['file_id'] . " total=" . ( $_start + $done ) . ")" );
|
||||
}
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
}
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "FINISHED Albums. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
@@ -0,0 +1,129 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Main public executable wrapper.
|
||||
* Set-up and load module to run
|
||||
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IP.Board Member Name SEO Fixer\n--------------------------------------------\n" );
|
||||
$this->_print( "Start from row?\nEnter: " );
|
||||
|
||||
$start = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_print( "Do X rows\nEnter: " );
|
||||
|
||||
$end = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_doTopics( $start, $end );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild langs
|
||||
*/
|
||||
protected function _doTopics( $_start, $end )
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$done = 0;
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'members',
|
||||
'order' => 'member_id ASC',
|
||||
'limit' => array( $_start, $end ) ) );
|
||||
|
||||
$t = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $t ) )
|
||||
{
|
||||
$members_seo_name = IPSText::makeSeoTitle( $row['members_display_name'] );
|
||||
|
||||
$this->DB->update( 'members', array( 'members_seo_name' => $members_seo_name ), 'member_id=' . $row['member_id'] );
|
||||
|
||||
$done++;
|
||||
|
||||
if ( $done % 250 == 0 )
|
||||
{
|
||||
$this->_print( "Completed... " . $done . " (Last ID=" . $row['member_id'] . " total=" . ( $_start + $done ) . ")" );
|
||||
}
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
}
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "COMPLETE. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,133 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Main public executable wrapper.
|
||||
* Set-up and load module to run
|
||||
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10721 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_IS_SHELL', TRUE );
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
|
||||
if ( is_file( './initdata.php' ) )
|
||||
{
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once( '../initdata.php' );/*noLibHook*/
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$moo = new moo( $reg );
|
||||
|
||||
class moo
|
||||
{
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
|
||||
$this->_print( "--------------------------------------------\nWelcome to the IP.Board Topic Title SEO Fixer\n--------------------------------------------\n" );
|
||||
$this->_print( "Start from row?\nEnter: " );
|
||||
|
||||
$start = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_print( "Do X rows\nEnter: " );
|
||||
|
||||
$end = intval( $this->_fetchOption() );
|
||||
|
||||
$this->_doTopics( $start, $end );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild langs
|
||||
*/
|
||||
protected function _doTopics( $_start, $end )
|
||||
{
|
||||
/* INIT */
|
||||
$start = time();
|
||||
$done = 0;
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'topics',
|
||||
'order' => 'tid ASC',
|
||||
'limit' => array( $_start, $end ) ) );
|
||||
|
||||
$t = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $t ) )
|
||||
{
|
||||
$title_seo = IPSText::makeSeoTitle( $row['title'] );
|
||||
$seo_last_name = IPSText::makeSeoTitle( $row['last_poster_name'] );
|
||||
$seo_first_name = IPSText::makeSeoTitle( $row['starter_name'] );
|
||||
|
||||
$this->DB->update( 'topics', array( 'title_seo' => $title_seo,
|
||||
'seo_last_name' => $seo_last_name,
|
||||
'seo_first_name' => $seo_first_name ), 'tid=' . $row['tid'] );
|
||||
|
||||
$done++;
|
||||
|
||||
if ( $done % 250 == 0 )
|
||||
{
|
||||
$this->_print( "Completed... " . $done . " (Last ID=" . $row['tid'] . " total=" . ( $_start + $done ) . ")" );
|
||||
}
|
||||
|
||||
/* Clear cached queries */
|
||||
$this->DB->obj['cached_queries'] = array();
|
||||
}
|
||||
|
||||
$end = time();
|
||||
$tkn = ( $end - $start) / 60;
|
||||
|
||||
$this->_print( "COMPLETE. Took " . $tkn . "m\n" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Out to stdout
|
||||
*/
|
||||
protected function _print( $message, $newline="\n" )
|
||||
{
|
||||
$stdout = fopen('php://stdout', 'w');
|
||||
fwrite( $stdout, $message . $newline );
|
||||
fclose( $stdout );
|
||||
}
|
||||
|
||||
/* Fetch option
|
||||
*
|
||||
*/
|
||||
protected function _fetchOption()
|
||||
{
|
||||
return trim( fgets( $this->stdin ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Simple skin change script
|
||||
* Place in your site root directory to send a user to a specified skin
|
||||
* Last Updated: $Date: 2012-05-16 10:43:54 -0400 (Wed, 16 May 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 10760 $
|
||||
*
|
||||
*/
|
||||
|
||||
define( 'IPS_PUBLIC_SCRIPT', 'index.php' );
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
if ( $_GET['id'] )
|
||||
{
|
||||
@header("Location: " . ipsRegistry::$settings['base_url'] . '&settingNewSkin=' . intval( $_GET['id'] ) . '&k=' . $reg->member()->form_hash );
|
||||
}
|
||||
else
|
||||
{
|
||||
die("No ID passed");
|
||||
}
|
||||
|
||||
exit();
|
||||
+123
-353
@@ -2,13 +2,15 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| Invision Power Board v<{%dyn.down.var.human.version%}>
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2004 Invision Power Services
|
||||
| (c) 2001 - 2009 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Time: <{%dyn.down.var.time%}>
|
||||
| Release: <{%dyn.down.var.md5%}>
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
@@ -18,6 +20,7 @@
|
||||
| > Date started: 29th April 2002
|
||||
| > UPDATED for 2.0: 1st July 2004
|
||||
| > UPDATED for 2.1: 13th Sept 2005
|
||||
| > UPDATED for 3.0: 26th Feb 2009
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
|
||||
@@ -28,25 +31,17 @@
|
||||
Simply call this script via PHP includes, or SSI .shtml tags to generate content
|
||||
on the fly, streamed into your own webpage.
|
||||
|
||||
+--------------------------------------------------------------------------
|
||||
| To show the last 10 topics and posts in the news forums...
|
||||
+--------------------------------------------------------------------------
|
||||
|
||||
include("http://domain.com/forums/ssi.php?a=news&show=10");
|
||||
|
||||
You can adjust the "show" attribute to display a different amount of topics.
|
||||
|
||||
+--------------------------------------------------------------------------
|
||||
| To show the board statistics
|
||||
+--------------------------------------------------------------------------
|
||||
|
||||
include("http://domain.com/forums/ssi.php?a=stats");
|
||||
include("http://domain.com/forums/ssi.php?a=stats");/*noLibHook*//*TERANOTE: remove additional /*
|
||||
|
||||
+--------------------------------------------------------------------------
|
||||
| To show the active users stats (x Members, X Guests, etc)
|
||||
+--------------------------------------------------------------------------
|
||||
|
||||
include("http://domain.com/forums/ssi.php?a=active");
|
||||
include("http://domain.com/forums/ssi.php?a=active");/*noLibHook*//*TERANOTE: remove additional /*
|
||||
|
||||
+--------------------------------------------------------------------------
|
||||
| RSS / XML Syndication..
|
||||
@@ -66,29 +61,25 @@ all the forums in the comma separated list
|
||||
*
|
||||
* Set-up and load module to run
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @package IP.Board
|
||||
* @author Matt Mecham
|
||||
* @version 2.1
|
||||
* @version 3.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script type
|
||||
*
|
||||
*/
|
||||
define( 'CCS_GATEWAY_CALLED', TRUE ); // Prevents redirect checks in ipsRegistry
|
||||
define( 'IPS_ENFORCE_ACCESS', TRUE ); // Prevents force login setting from returning a login page
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
|
||||
require_once( './init.php' );
|
||||
require_once( './initdata.php' );/*noLibHook*/
|
||||
|
||||
//--------------------------------
|
||||
// Other set up
|
||||
//--------------------------------
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );/*noLibHook*/
|
||||
|
||||
/**
|
||||
* Path to SSI templates directory
|
||||
*
|
||||
*/
|
||||
define( 'SSI_TEMPLATES_DIR', ROOT_PATH."ssi_templates" );
|
||||
define( 'SSI_TEMPLATES_DIR', DOC_IPS_ROOT_PATH."ssi_templates" );
|
||||
/**
|
||||
* Maximum number of topics to show
|
||||
*
|
||||
@@ -101,158 +92,44 @@ define( 'SSI_MAX_SHOW' , 100 );
|
||||
*/
|
||||
define( 'SSI_ALLOW_SYND' , 1 );
|
||||
|
||||
//===========================================================================
|
||||
// MAIN PROGRAM
|
||||
//===========================================================================
|
||||
/* Go... */
|
||||
$reg = ipsRegistry::instance();
|
||||
$reg->init();
|
||||
|
||||
$INFO = array();
|
||||
$ssi = new ssi( $reg );
|
||||
|
||||
//--------------------------------
|
||||
// Load our classes
|
||||
//--------------------------------
|
||||
|
||||
require_once ROOT_PATH . "sources/ipsclass.php";
|
||||
require_once ROOT_PATH . "sources/classes/class_forums.php";
|
||||
require_once ROOT_PATH . "sources/classes/class_session.php";
|
||||
require_once KERNEL_PATH . "class_converge.php";
|
||||
require_once ROOT_PATH . "conf_global.php";
|
||||
|
||||
# Initiate super-class
|
||||
$ipsclass = new ipsclass();
|
||||
$ipsclass->vars = $INFO;
|
||||
|
||||
//--------------------------------
|
||||
// The clocks a' tickin'
|
||||
//--------------------------------
|
||||
|
||||
$Debug = new Debug;
|
||||
$Debug->startTimer();
|
||||
|
||||
//--------------------------------
|
||||
// Load the DB driver and such
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->init_db_connection();
|
||||
|
||||
//--------------------------------
|
||||
// INIT other classes
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->sess = new session();
|
||||
$ipsclass->sess->ipsclass =& $ipsclass;
|
||||
|
||||
$ipsclass->forums = new forum_functions();
|
||||
$ipsclass->forums->ipsclass =& $ipsclass;
|
||||
|
||||
//--------------------------------
|
||||
// Set up our vars
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->parse_incoming();
|
||||
|
||||
//--------------------------------
|
||||
// Set converge
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->converge = new class_converge( $ipsclass->DB );
|
||||
|
||||
//--------------------------------
|
||||
// Start off the cache array
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->cache_array = array_merge( array('attachtypes','bbcode', 'multimod','ranks','profilefields'), array('rss_calendar', 'rss_export','components','banfilters', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats', 'languages') );
|
||||
|
||||
//===========================================================================
|
||||
// Get cache...
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->init_cache_setup();
|
||||
$ipsclass->init_load_cache( $ipsclass->cache_array );
|
||||
|
||||
//--------------------------------
|
||||
// Set debug mode
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->DB->set_debug_mode( $ipsclass->vars['sql_debug'] == 1 ? intval($_GET['debug']) : 0 );
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->initiate_ipsclass();
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the member info
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->member = $ipsclass->sess->authorise();
|
||||
|
||||
//-----------------------------------------
|
||||
// Cache md5 check
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->md5_check = $ipsclass->return_md5_check();
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the forums
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->forums->strip_invisible = 1;
|
||||
$ipsclass->forums->forums_init();
|
||||
|
||||
//--------------------------------
|
||||
// Load the skin
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->load_skin();
|
||||
|
||||
//--------------------------------
|
||||
// Set the base URL
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->base_url = $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'];
|
||||
|
||||
//--------------------------------
|
||||
// INIT class and pass...
|
||||
//--------------------------------
|
||||
|
||||
$runme = new ssi_autorun();
|
||||
$runme->ipsclass =& $ipsclass;
|
||||
$runme->auto_run();
|
||||
|
||||
|
||||
/**
|
||||
* Auto run class
|
||||
*/
|
||||
class ssi_autorun
|
||||
class ssi
|
||||
{
|
||||
/**
|
||||
* Auto run function
|
||||
*/
|
||||
function auto_run()
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
//--------------------------------
|
||||
// What to do?
|
||||
//--------------------------------
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
|
||||
switch ($this->ipsclass->input['a'])
|
||||
/* Load forums class */
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('forums') . '/sources/classes/forums/class_forums.php', 'class_forums', 'forums' );
|
||||
$this->registry->setClass( 'class_forums', new $classToLoad( $registry ) );
|
||||
$this->registry->class_forums->forumsInit();
|
||||
|
||||
switch ($this->request['a'])
|
||||
{
|
||||
case 'news':
|
||||
$this->do_news();
|
||||
break;
|
||||
|
||||
case 'active':
|
||||
$this->do_active();
|
||||
$this->_doActive();
|
||||
break;
|
||||
|
||||
case 'stats':
|
||||
$this->do_stats();
|
||||
$this->_doStats();
|
||||
break;
|
||||
|
||||
case 'out':
|
||||
if ( SSI_ALLOW_SYND == 1 )
|
||||
{
|
||||
$this->do_syndication();
|
||||
$this->_doSyndication();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -261,18 +138,20 @@ class ssi_autorun
|
||||
break;
|
||||
|
||||
default:
|
||||
echo("An error occured whilst processing this directive");
|
||||
echo("An error occurred whilst processing this directive");
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do Syndication
|
||||
*
|
||||
* Export topics / titles from selected forums
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
function do_syndication()
|
||||
protected function _doSyndication()
|
||||
{
|
||||
//----------------------------------------
|
||||
// Sort out the forum ids
|
||||
@@ -281,9 +160,9 @@ class ssi_autorun
|
||||
$tmp_forums = array();
|
||||
$forums = array();
|
||||
|
||||
if ( $this->ipsclass->input['f'] )
|
||||
if ( $this->request['f'] )
|
||||
{
|
||||
$tmp_forums = explode( ",", $this->ipsclass->input['f'] );
|
||||
$tmp_forums = explode( ",", $this->request['f'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -319,7 +198,7 @@ class ssi_autorun
|
||||
// Number of topics to return?
|
||||
//----------------------------------------
|
||||
|
||||
$perpage = intval($this->ipsclass->input['show']) ? intval($this->ipsclass->input['show']) : 10;
|
||||
$perpage = intval($this->request['show']) ? intval($this->request['show']) : 10;
|
||||
|
||||
$perpage = ( $perpage > SSI_MAX_SHOW ) ? SSI_MAX_SHOW : $perpage;
|
||||
|
||||
@@ -327,13 +206,13 @@ class ssi_autorun
|
||||
// Load the template...
|
||||
//----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->input['type'] == 'xml' )
|
||||
if ( $this->request['type'] == 'xml' )
|
||||
{
|
||||
$template = $this->load_template("syndicate_xml.html");
|
||||
$template = $this->_loadTemplate("syndicate_xml.html");
|
||||
}
|
||||
else
|
||||
{
|
||||
$template = $this->load_template("syndicate_rss.html");
|
||||
$template = $this->_loadTemplate("syndicate_rss.html");
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
@@ -361,71 +240,65 @@ class ssi_autorun
|
||||
// Header parse...
|
||||
//----------------------------------------
|
||||
|
||||
@header("Content-Type: text/xml;charset={$this->ipsclass->vars['gb_char_set']}");
|
||||
@header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
@header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
@header('Pragma: public');
|
||||
//@header("Content-Type: text/xml;charset={$this->settings['gb_char_set']}");
|
||||
//@header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
//@header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
//@header('Pragma: public');
|
||||
|
||||
$to_echo .= $this->parse_template( $top, array (
|
||||
'board_url' => $this->ipsclass->base_url ,
|
||||
'board_name' => $this->ipsclass->vars['board_name'],
|
||||
) );
|
||||
$to_echo .= $this->_parseTemplate( $top, array ( 'board_url' => $this->settings['base_url'] ,
|
||||
'board_name' => $this->settings['board_name'] ) );
|
||||
|
||||
//----------------------------------------
|
||||
// Fix up
|
||||
//----------------------------------------
|
||||
|
||||
$group = $this->ipsclass->cache['group_cache'][ $this->ipsclass->vars['guest_group'] ];
|
||||
|
||||
$this->ipsclass->perm_id_array = explode( ",", $group['g_perm_id'] );
|
||||
|
||||
$group = $this->caches['group_cache'][ $this->settings['guest_group'] ];
|
||||
|
||||
//----------------------------------------
|
||||
// Get the topics, member info and other stuff
|
||||
//----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'topics',
|
||||
'where' => "forum_id IN ($sql_fields) AND approved=1",
|
||||
'where' => "forum_id IN ($sql_fields) AND " . $this->registry->getClass('class_forums')->fetchTopicHiddenQuery( array( 'visible' ), '' ),
|
||||
'order' => 'last_post DESC',
|
||||
'limit' => array( 0, $perpage ) ) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $this->ipsclass->DB->get_num_rows() )
|
||||
if ( ! $this->DB->getTotalRows() )
|
||||
{
|
||||
fatal_error("Could not get the information from the database");
|
||||
}
|
||||
|
||||
while ( $i = $this->ipsclass->DB->fetch_row() )
|
||||
while ( $i = $this->DB->fetch() )
|
||||
{
|
||||
$forum = $this->ipsclass->forums->forum_by_id[ $i['forum_id'] ];
|
||||
$forum = $this->registry->class_forums->forum_by_id[ $i['forum_id'] ];
|
||||
|
||||
if ( $this->ipsclass->check_perms( $forum['read_perms'] ) != TRUE )
|
||||
if ( $this->registry->permissions->check( 'read', $forum ) != TRUE )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $forum['password'] != "" )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($forum['password'] != "" )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$to_echo .= $this->parse_template( $row, array (
|
||||
'topic_title' => str_replace( '&#', '&#', $i['title'] ),
|
||||
$to_echo .= $this->_parseTemplate( $row, array ( 'topic_title' => str_replace( '&#', '&#', $i['title'] ),
|
||||
'topic_id' => $i['tid'],
|
||||
'topic_link' => $this->ipsclass->base_url."?showtopic=".$i['tid'],
|
||||
'topic_link' => $this->settings['base_url']."showtopic=".$i['tid'],
|
||||
'forum_title' => htmlspecialchars($forum['name']),
|
||||
'forum_id' => $i['forum_id'],
|
||||
'last_poster_id' => $i['last_poster_id'],
|
||||
'last_post_name' => $i['last_poster_name'],
|
||||
'last_post_time' => $this->ipsclass->get_date( $i['last_post'] , 'LONG', 1 ),
|
||||
'last_post_time' => $this->registry->getClass('class_localization')->getDate( $i['last_post'] , 'LONG', 1 ),
|
||||
'timestamp' => $i['last_post'],
|
||||
'starter_id' => $i['starter_id'],
|
||||
'starter_name' => $i['starter_name'],
|
||||
'board_url' => $this->ipsclass->base_url ,
|
||||
'board_name' => $this->ipsclass->vars['board_name'],
|
||||
'rfc_date' => date( 'r', $i['last_post'] ),
|
||||
) ) . "\r\n";
|
||||
'board_url' => $this->settings['board_url'] ,
|
||||
'board_name' => $this->settings['board_name'],
|
||||
'rfc_date' => date( 'r', $i['last_post'] ) ) ) . "\r\n";
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
@@ -443,13 +316,13 @@ class ssi_autorun
|
||||
*
|
||||
* Show totals
|
||||
*/
|
||||
function do_stats()
|
||||
function _doStats()
|
||||
{
|
||||
//----------------------------------------
|
||||
// Load the template...
|
||||
//----------------------------------------
|
||||
|
||||
$template = $this->load_template("stats.html");
|
||||
$template = $this->_loadTemplate("stats.html");
|
||||
|
||||
//----------------------------------------
|
||||
// INIT
|
||||
@@ -458,140 +331,29 @@ class ssi_autorun
|
||||
$to_echo = "";
|
||||
$time = time() - 900;
|
||||
|
||||
//----------------------------------------
|
||||
// Make sure we've got something
|
||||
//----------------------------------------
|
||||
|
||||
if ( ! is_array( $this->ipsclass->cache['stats'] ) )
|
||||
{
|
||||
$this->ipsclass->cache['stats'] = array();
|
||||
|
||||
$this->ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 1 ) );
|
||||
}
|
||||
|
||||
$stats = $this->ipsclass->cache['stats'];
|
||||
$total_posts = $stats['total_replies']+$stats['total_topics'];
|
||||
$to_echo = $this->parse_template( $template,
|
||||
array (
|
||||
'total_posts' => $total_posts,
|
||||
$stats = $this->caches['stats'];
|
||||
$total_posts = $stats['total_replies'] + $stats['total_topics'];
|
||||
$to_echo = $this->_parseTemplate( $template, array( 'total_posts' => $total_posts,
|
||||
'topics' => $stats['total_topics'],
|
||||
'replies' => $stats['total_replies'],
|
||||
'members' => $stats['mem_count']
|
||||
)
|
||||
);
|
||||
'members' => $stats['mem_count'] ) );
|
||||
echo $to_echo;
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do News
|
||||
*
|
||||
* Show news text
|
||||
*/
|
||||
function do_news()
|
||||
{
|
||||
//----------------------------------------
|
||||
// Check
|
||||
//----------------------------------------
|
||||
|
||||
if ( (! $this->ipsclass->vars['news_forum_id']) or ($this->ipsclass->vars['news_forum_id'] == "" ) )
|
||||
{
|
||||
fatal_error("No news forum assigned");
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// INIT
|
||||
//----------------------------------------
|
||||
|
||||
$perpage = intval($this->ipsclass->input['show']) > 0 ? intval($this->ipsclass->input['show']) : 10;
|
||||
$perpage = ( $perpage > SSI_MAX_SHOW ) ? SSI_MAX_SHOW : $perpage;
|
||||
$to_echo = "";
|
||||
|
||||
//-----------------------------------------
|
||||
// Load the template...
|
||||
//-----------------------------------------
|
||||
|
||||
$template = $this->load_template("news.html");
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the topics, member info and other stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.forum_id={$this->ipsclass->vars['news_forum_id']} AND t.approved=1",
|
||||
'order' => 't.tid DESC',
|
||||
'limit' => array( 0, $perpage ),
|
||||
'add_join' => array( 0 => array( 'select' => 'm.members_display_name as member_name, m.mgroup, m.id as member_id,m.title as member_title',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.id=t.starter_id",
|
||||
'type' => 'left' ),
|
||||
1 => array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "t.topic_firstpost=p.pid",
|
||||
'type' => 'left' ) )
|
||||
) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
while ( $row = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$row['member_name'] = $row['member_name'] ? $row['member_name'] : $row['author_name'];
|
||||
|
||||
$to_echo .= $this->parse_template( $template,
|
||||
array (
|
||||
'profile_link' => $this->ipsclass->base_url."?showuser=".intval($row['member_id']),
|
||||
'member_name' => $row['member_name'],
|
||||
'post_date' => $this->ipsclass->get_date( $row['post_date'], 'LONG', 1 ),
|
||||
'topic_title' => $row['title'],
|
||||
'post' => $row['post'],
|
||||
'comments' => $row['posts'],
|
||||
'view_all_link' => $this->ipsclass->base_url."?showtopic={$row['tid']}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the macros and replace them
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $this->ipsclass->skin['_macros'] ) )
|
||||
{
|
||||
foreach( $this->ipsclass->skin['_macros'] as $row )
|
||||
{
|
||||
if ( $row['macro_value'] != "" )
|
||||
{
|
||||
$to_echo = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $to_echo );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$to_echo = preg_replace( "#([^/])style_images/(<\#IMG_DIR\#>|".preg_quote($this->ipsclass->skin['_imagedir'], '/').")#is", "\\1".$this->ipsclass->vars['board_url']."/style_images/\\2", $to_echo );
|
||||
$to_echo = preg_replace( "#([^/])style_emoticons#is", "\\1".$this->ipsclass->vars['board_url']."/style_emoticons", $to_echo );
|
||||
$to_echo = preg_replace( "#([^/])style_avatars#is" , "\\1".$this->ipsclass->vars['board_url']."/style_avatars", $to_echo );
|
||||
$to_echo = preg_replace( "#([^/])jscripts#is" , "\\1".$this->ipsclass->vars['board_url']."/jscripts", $to_echo );
|
||||
|
||||
$to_echo = str_replace( "<#IMG_DIR#>", $this->ipsclass->skin['_imagedir'], $to_echo );
|
||||
$to_echo = str_replace( "<#EMO_DIR#>", $this->ipsclass->skin['_emodir'] , $to_echo );
|
||||
|
||||
echo $to_echo;
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do Active
|
||||
*
|
||||
* Show active users
|
||||
*/
|
||||
function do_active()
|
||||
function _doActive()
|
||||
{
|
||||
//--------------------------------
|
||||
// Load the template...
|
||||
//--------------------------------
|
||||
|
||||
$template = $this->load_template("active.html");
|
||||
$template = $this->_loadTemplate("active.html");
|
||||
|
||||
//--------------------------------
|
||||
// INIT
|
||||
@@ -603,43 +365,42 @@ class ssi_autorun
|
||||
// Make sure we have a cut off...
|
||||
//--------------------------------
|
||||
|
||||
if ($this->ipsclass->vars['au_cutoff'] == "")
|
||||
if ($this->settings['au_cutoff'] == "")
|
||||
{
|
||||
$this->ipsclass->vars['au_cutoff'] = 15;
|
||||
$this->settings['au_cutoff'] = 15;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the users from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$cut_off = $this->ipsclass->vars['au_cutoff'] * 60;
|
||||
$cut_off = $this->settings['au_cutoff'] * 60;
|
||||
$time = time() - $cut_off;
|
||||
$rows = array();
|
||||
$ar_time = time();
|
||||
|
||||
if ( $this->ipsclass->member['id'] )
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
$rows = array( $ar_time => array( 'login_type' => substr($this->ipsclass->member['login_anonymous'],0, 1),
|
||||
$rows = array( $ar_time => array( 'login_type' => IPSMember::isLoggedInAnon( $this->memberData ),
|
||||
'running_time' => $ar_time,
|
||||
'member_id' => $this->ipsclass->member['id'],
|
||||
'member_name' => $this->ipsclass->member['members_display_name'],
|
||||
'member_group' => $this->ipsclass->member['mgroup'] ) );
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'member_name' => $this->memberData['members_display_name'],
|
||||
'member_group' => $this->memberData['member_group_id'] ) );
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'id, member_id, member_name, login_type, running_time, member_group',
|
||||
'from' => 'sessions',
|
||||
'where' => "running_time > $time",
|
||||
//'order' => "running_time DESC" // Sort in PHP to avoid filesort in SQL
|
||||
) );
|
||||
$this->DB->build( array( 'select' => 'id, member_id, member_name, login_type, running_time, member_group',
|
||||
'from' => 'sessions',
|
||||
'where' => "running_time > $time",
|
||||
) );
|
||||
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
$this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// FETCH...
|
||||
//-----------------------------------------
|
||||
|
||||
while ( $r = $this->ipsclass->DB->fetch_row() )
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$rows[ $r['running_time'].'.'.$r['id'] ] = $r;
|
||||
}
|
||||
@@ -656,8 +417,6 @@ class ssi_autorun
|
||||
|
||||
foreach( $rows as $result )
|
||||
{
|
||||
$last_date = $this->ipsclass->get_time( $result['running_time'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Bot?
|
||||
//-----------------------------------------
|
||||
@@ -703,7 +462,10 @@ class ssi_autorun
|
||||
{
|
||||
$cached[ $result['member_id'] ] = 1;
|
||||
|
||||
if ($result['login_type'])
|
||||
/* Reset login type in case the board/group setting got changed */
|
||||
$result['login_type'] = IPSMember::isLoggedInAnon( array( 'login_anonymous' => $result['login_type'] ), $result['member_group'] );
|
||||
|
||||
if ( $result['login_type'] )
|
||||
{
|
||||
$active['ANON']++;
|
||||
}
|
||||
@@ -717,15 +479,10 @@ class ssi_autorun
|
||||
|
||||
$active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
|
||||
|
||||
|
||||
$to_echo = $this->parse_template( $template,
|
||||
array (
|
||||
'total' => $active['TOTAL'] ? $active['TOTAL'] : 0 ,
|
||||
$to_echo = $this->_parseTemplate( $template, array ( 'total' => $active['TOTAL'] ? $active['TOTAL'] : 0 ,
|
||||
'members' => $active['MEMBERS'] ? $active['MEMBERS'] : 0,
|
||||
'guests' => $active['GUESTS'] ? $active['GUESTS'] : 0,
|
||||
'anon' => $active['ANON'] ? $active['ANON'] : 0,
|
||||
)
|
||||
);
|
||||
'anon' => $active['ANON'] ? $active['ANON'] : 0 ) );
|
||||
|
||||
|
||||
echo $to_echo;
|
||||
@@ -738,27 +495,36 @@ class ssi_autorun
|
||||
* Parse template
|
||||
*
|
||||
* Parses the template. Duh.
|
||||
*
|
||||
* @access protected
|
||||
* @param string Template data
|
||||
* @param array Array of data
|
||||
*/
|
||||
function parse_template( $template, $assigned=array() )
|
||||
protected function _parseTemplate( $template, $assigned=array() )
|
||||
{
|
||||
foreach( $assigned as $word => $replace)
|
||||
{
|
||||
$template = preg_replace( "/\{$word\}/i", "$replace", $template );
|
||||
}
|
||||
|
||||
return $template;
|
||||
$template = str_replace( '/ssi.php', '/index.php', $template );
|
||||
|
||||
return $this->registry->output->replaceMacros( $template );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load template
|
||||
*
|
||||
* Loads the template
|
||||
*
|
||||
* @access protected
|
||||
* @param string Template to load
|
||||
*/
|
||||
function load_template($template="")
|
||||
protected function _loadTemplate($template="")
|
||||
{
|
||||
$filename = SSI_TEMPLATES_DIR."/".$template;
|
||||
|
||||
if ( file_exists($filename) )
|
||||
if ( is_file($filename) )
|
||||
{
|
||||
if ( $FH = fopen($filename, 'r') )
|
||||
{
|
||||
@@ -777,6 +543,10 @@ class ssi_autorun
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
function fatal_error( $error )
|
||||
{
|
||||
print $error;
|
||||
exit();
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<html>␍<head><title>Invision Power Board - Bulletin Board System</title></head>␍<body>␍<h1>403: Invision Power Board -> Forbidden</h1>␍<hr>␍You have reached this Page in error, please use␍your back button to return to Invision Board.␍<hr>␍<a href="http://anonym.to/http://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
|
||||
<html>␍<head><title>Invision Power Board - Bulletin Board System</title></head>␍<body>␍<h1>403: Invision Power Board -> Forbidden</h1>␍<hr>␍You have reached this Page in error, please use␍your back button to return to Invision Board.␍<hr>␍<a href="http://www.invisionpower.com">Invision Power Board</a>␍</body>␍</html>␍
|
||||
@@ -1 +0,0 @@
|
||||
<table cellpadding='4' cellspacing='1' border='0' width='100%' bgcolor='#000000' style='font-family:Verdana;font-size:11px'>␍<tr>␍ <td align='left' bgcolor='#CCCCCC'>Posted By: <a href='{profile_link}'>{member_name}</a><br>Posted On: {post_date}</td>␍</tr>␍<tr>␍ <td align='left' bgcolor='#FEFEFE'>␍ <b>Title: {topic_title}</b>␍ <br><br>␍ <table style='border:1px dotted gray;width:100%;font-family:Verdana;font-size:10px'><tr><td>{post}</td></tr></table><br>Comments: {comments} :: <a href='{view_all_link}'>View Comments</a>␍ </td>␍</tr>␍</table>␍<br>
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Installer: Upgrader core file
|
||||
* Last Updated: $LastChangedDate: 2013-01-29 14:15:42 -0500 (Tue, 29 Jan 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: AndyMillne $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 11913 $
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
This script completes the upgrade from modules onwards
|
||||
Move the 'upgradeFinish' folder into your 'admin' directory
|
||||
and access via your web browser
|
||||
*/
|
||||
|
||||
$startPoint = 'modules';
|
||||
|
||||
define( 'IPB_THIS_SCRIPT', 'admin' );
|
||||
define( 'IPS_IS_UPGRADER', TRUE );
|
||||
define( 'IPS_IS_INSTALLER', FALSE );
|
||||
|
||||
require_once( '../../initdata.php' );/*noLibHook*/
|
||||
|
||||
# Bypass security check
|
||||
if ( ! $_GET['s'] )
|
||||
{
|
||||
$_GET['section'] = 'index';
|
||||
$_POST['section'] = 'index';
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'setup/sources/base/ipsRegistry_setup.php' );/*noLibHook*/
|
||||
require_once( IPS_ROOT_PATH . 'setup/sources/base/ipsController_setup.php' );/*noLibHook*/
|
||||
|
||||
/* INIT */
|
||||
ipsRegistry::init();
|
||||
|
||||
/* Fetch admin */
|
||||
if ( ! $_GET['s'] )
|
||||
{
|
||||
$admin = ipsRegistry::DB()->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'members',
|
||||
'where' => 'member_group_id=' . ipsRegistry::$settings['admin_group'],
|
||||
'order' => 'last_visit DESC',
|
||||
'limit' => array( 0,1 ) ) );
|
||||
/* Set up a session */
|
||||
ipsRegistry::$request['s'] = ipsRegistry::member()->sessionClass()->createSession( $admin, $admin['member_login_key'] );
|
||||
|
||||
|
||||
$_GET['section'] = 'upgrade';
|
||||
$_POST['section'] = 'upgrade';
|
||||
ipsRegistry::$request['section'] = 'upgrade';
|
||||
ipsRegistry::$current_section = 'upgrade';
|
||||
|
||||
/* Set up the correct module */
|
||||
$_GET['do'] = ( $_GET['do'] ) ? $_GET['do'] : $startPoint;
|
||||
$_POST['do'] = ( $_POST['do'] ) ? $_POST['do'] : $startPoint;
|
||||
ipsRegistry::$request['do'] = ( ipsRegistry::$request['do'] ) ? ipsRegistry::$request['do'] : $startPoint;
|
||||
|
||||
$apps = array( 'core', 'forums', 'members' );
|
||||
$toSave = array();
|
||||
$vNums = array();
|
||||
|
||||
if ( is_array( $apps ) and count( $apps ) )
|
||||
{
|
||||
IPSSetUp::setSavedData( 'install_apps', implode( ',', $apps ) );
|
||||
|
||||
/* Grab data */
|
||||
foreach( $apps as $app )
|
||||
{
|
||||
/* Grab version numbers */
|
||||
$numbers = IPSSetUp::fetchAppVersionNumbers( $app );
|
||||
|
||||
/* Grab all numbers */
|
||||
$nums[ $app ] = IPSSetUp::fetchXmlAppVersions( $app );
|
||||
|
||||
/* Grab app data */
|
||||
$appData[ $app ] = IPSSetUp::fetchXmlAppInformation( $app );
|
||||
|
||||
$appClasses[ $app ] = IPSSetUp::fetchVersionClasses( $app, $numbers['current'][0], $numbers['latest'][0] );
|
||||
|
||||
/* Store starting vnums */
|
||||
$vNums[ $app ] = $numbers['current'][0];
|
||||
}
|
||||
|
||||
/* Got anything? */
|
||||
if ( count( $appClasses ) )
|
||||
{
|
||||
foreach( $appClasses as $app => $data )
|
||||
{
|
||||
foreach( $data as $num )
|
||||
{
|
||||
if ( is_file( IPSLib::getAppDir( $app ) . '/setup/versions/upg_' . $num . '/version_class.php' ) )
|
||||
{
|
||||
$_class = 'version_class_' . $app . '_' . $num;
|
||||
require_once( IPSLib::getAppDir( $app ) . '/setup/versions/upg_' . $num . '/version_class.php' );/*noLibHook*/
|
||||
|
||||
$_tmp = new $_class( ipsRegistry::instance() );
|
||||
|
||||
if ( method_exists( $_tmp, 'preInstallOptionsSave' ) )
|
||||
{
|
||||
$_t = $_tmp->preInstallOptionsSave();
|
||||
|
||||
if ( is_array( $_t ) AND count( $_t ) )
|
||||
{
|
||||
$toSave[ $app ][ $num ] = $_t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Save it */
|
||||
if ( count( $toSave ) )
|
||||
{
|
||||
IPSSetUp::setSavedData('custom_options', $toSave );
|
||||
}
|
||||
|
||||
if ( count( $vNums ) )
|
||||
{
|
||||
IPSSetUp::setSavedData('version_numbers', $vNums );
|
||||
}
|
||||
}
|
||||
|
||||
/* Freeze data */
|
||||
IPSSetUp::freezeSavedData();
|
||||
|
||||
/* Thaw it */
|
||||
IPSSetUp::thawSavedData();
|
||||
}
|
||||
}
|
||||
|
||||
/* Run our controller */
|
||||
ipsController::run();
|
||||
Reference in new issue
Block a user