<?php $versions = array('1', '2.0.4', '2.0.5', '2.0.6', '2.0.7', '2.0.8', '2.0.9', '2.0.91', '2.1', '2.2', '2.3', '2.4', '2.4.5', '2.5', '2.5.1', '2.6', '2.7', '2.7.0.1', '2.7.0.02', '2.7.0.3', '2.7.0.4', '2.7.0.5', '2.7.1', '2.7.2', '2.7.3', '2.7.4', '2.7.5', '2.7.6', '2.8'); /** * Function used to upgrade ClipBucket */ function is_upgradeable() { global $versions; //checking for Installed ClipBucket file if (file_exists("../includes/clipbucket.php")) { $contents = file_get_contents("../includes/clipbucket.php"); if ($contents) { preg_match("/define\\(\"VERSION\",\"([\\d.]+)\"\\);/i", $contents, $matches); } $version = $matches[1]; } if (in_array(@$version, $versions) && $version < VERSION) { return $version; } else { return false; } } /** * ClipBucket v2.1 Installaer */ //Checking if clipbucket is upgradable $upgrade = is_upgradeable();
if (!$mode || !in_array($mode, $modes)) { if (!$upgrade) { $mode = 'agreement'; } else { $mode = 'upgrade'; } } $configIncluded = false; /** * Clipbucket modes * modes which requires clipbucket core files so installer * function file does not create a conflict */ $cbarray = array('adminsettings', 'sitesettings', 'register', 'finish'); $baseDir = dirname(dirname(__FILE__)); if ($version = is_upgradeable()) { if ((int) $version <= 2.6) { $originalDbFile = file_get_contents($baseDir . '/includes/dbconnect.php'); preg_match("/DBHOST = '(.*)';/", $originalDbFile, $matches); $host = array_pop($matches); preg_match("/DBNAME = '(.*)';/", $originalDbFile, $matches); $name = array_pop($matches); preg_match("/DBUSER = '******';/", $originalDbFile, $matches); $user = array_pop($matches); preg_match("/DBPASS = '******';/", $originalDbFile, $matches); $pass = array_pop($matches); preg_match("/define\\('TABLE_PREFIX','(.*)'\\);/", $originalDbFile, $matches); $prefix = array_pop($matches); $dbconnect = file_get_contents($baseDir . '/cb_install/dbconnect.php'); $dbconnect = str_replace('_DB_HOST_', $host, $dbconnect); $dbconnect = str_replace('_DB_NAME_', $name, $dbconnect);