News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Paste-1309742735:v:use_geshi-1:v:type-php

Started by SleePy, Jul 04, 2011, 01:25 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

SleePy

<?php
$other_path = '/home/svn/sm-smf/trunk/other';
$settings_path = '/home/smf/svn_files';

$php_open = '<' . '?' . 'php';
$php_close = '?' . '>';
require_once(dirname(__FILE__) . '/Settings.php');


// Is it cached?
if (file_exists($settings_path . '/upgrade_emulate_cache') && !empty($_REQUEST['data']))
   $contents = file_get_contents($settings_path . '/upgrade_emulate_cache');
else
{
   // Get.
   $contents = file_get_contents($other_path . '/upgrade.php');

   // Edit.
   $contents = strtr($contents, array(
      'dirname(__FILE__)' => '\'' . $other_path . '\'',
      'require_once($upgrade_path . \'/Settings.php\');' => 'require_once(\'' . $settings_path . '/Settings.php\');',
      'require_once(dirname(__FILE__) . \'/upgrade_1-0.sql\');' => 'require_once(\'' . $other_path . '/upgrade_1-0.sql\');',
      'require_once(dirname(__FILE__) . \'/upgrade_1-1.sql\');' => 'require_once(\'' . $other_path . '/upgrade_1-1.sql\');',
      'require_once(dirname(__FILE__) . \'/upgrade_2-0_mysql.sql\');' => 'require_once(\'' . $other_path . '/upgrade_2-0_mysql.sql\');',
      'require_once(dirname(__FILE__) . \'/upgrade_2-0_postgresql.sql\');' => 'require_once(\'' . $other_path . '/upgrade_2-0_postgresql.sql\');',
      'require_once(dirname(__FILE__) . \'/upgrade_2-0_sqlite.sql\');' => 'require_once(\'' . $other_path . '/upgrade_2-0_sqlite.sql\');',
      'dirname(__FILE__) . \'/upgrade_2-0_\' . $db_type . \'.sql\'' => '\'' . $other_path . '/upgrade_2-0_\' . $db_type . \'.sql\'',
      '$boarddir . \'/Settings' => '\'' . $settings_path . '/Settings',
   ));

   // Prepare.
   $contents = substr($contents, strlen($php_open), -strlen($php_close));

   file_put_contents($settings_path . '/upgrade_emulate_cache', $contents);
}

// Send.
eval($contents);

// done.
exit;
?>
No siggy! :D