コード例 #1
0
function buildSandpitDB($dbName)
{
    // creates the sandpit database as a starting point for users to register and create databases
    echo_flush("<p>Create new empty database</p>");
    if (!createDatabaseEmpty($dbName)) {
        return false;
    }
    createDatabaseFolders($dbName);
    return true;
}
コード例 #2
0
    exec_queries();
}
// #############################################################################
// step 2
if ($vbulletin->GPC['step'] == 2) {
    require_once DIR . '/includes/functions_misc.php';
    // change post title field
    echo_flush("<p>" . sprintf($upgrade_phrases['upgrade_300b5.php']['alter_post_title'], TABLE_PREFIX) . "</i>");
    $t = microtime();
    $db->query_write("\n\t\tALTER TABLE " . TABLE_PREFIX . "post\n\t\tCHANGE title title VARCHAR(250) NOT NULL DEFAULT ''\n\t");
    echo_flush('<br />' . sprintf($vbphrase['query_took'], number_format(fetch_microtime_difference($t), 2)) . '</p>');
    // change thread title field
    echo_flush("<p>" . sprintf($upgrade_phrases['upgrade_300b5.php']['alter_thread_title'], TABLE_PREFIX) . "</i>");
    $t = microtime();
    $db->query_write("\n\t\tALTER TABLE " . TABLE_PREFIX . "thread\n\t\tCHANGE title title VARCHAR(250) NOT NULL DEFAULT ''\n\t");
    echo_flush('<br />' . sprintf($vbphrase['query_took'], number_format(fetch_microtime_difference($t), 2)) . '</p>');
}
// #############################################################################
// ask user if they want to change a setting that is causing some of the CP login issues
if ($vbulletin->GPC['step'] == 3) {
    $vbulletin->input->clean_array_gpc('p', array('settingconfirm' => TYPE_UINT, 'disablesetting' => TYPE_UINT));
    if ($vbulletin->GPC['settingconfirm'] == 1) {
        echo '<p>';
        if ($vbulletin->GPC['disablesetting'] == 1) {
            $db->query_write("UPDATE " . TABLE_PREFIX . "setting SET value=0 WHERE varname='timeoutcontrolpanel'");
            echo $upgrade_phrases['upgrade_300b5.php']['disabled_timeout_admin'];
        } else {
            echo $upgrade_phrases['upgrade_300b5.php']['timeout_admin_not_changed'];
        }
        echo '</p>';
    } else {
コード例 #3
0
ファイル: installsteps.php プロジェクト: hungnv0789/vhtm
	if ($vbulletin->GPC['step'] == 14)
	{
		$vbulletin->input->clean_array_gpc('p', array(
			'install_do' => TYPE_STR,
		));

		require_once(DIR . "/install/cmsdefaultdata/default_data_functions.php");

		if (!$vbulletin->GPC['skip'])
		{
			if ($vbulletin->GPC['install_do'] AND can_install_default_data())
			{
				add_default_data();
				add_default_attachments(1);
				echo_flush("<p>" . $install_phrases['cms_data_import_success'] . "</p>");
			}
			elseif (can_install_default_data() AND $vbulletin->GPC['cmsdefault'] == true)
			{ // Just installing the CMS default data no need to rebuild style info
				define('HIDEPROCEED', true);
				print_cms_default_data_overwrite_form();
			}
			else
			{ // Normal CMS install
				install_product_step('vbcms');
				$row = $vbulletin->db->query_first("
					SELECT COUNT(*) AS count
					FROM " . TABLE_PREFIX . "cms_node
					WHERE nodeid <> 1"
				);
コード例 #4
0
function cloneDatabase($targetdbname)
{
    set_time_limit(0);
    $newname = HEURIST_DB_PREFIX . $targetdbname;
    //create new empty database
    if (!db_create($newname)) {
        return false;
    }
    echo_flush("<p>Create Database Structure (tables)</p>");
    if (db_script($newname, HEURIST_DIR . "admin/setup/dbcreate/blankDBStructure.sql")) {
        echo_flush('<p style="padding-left:20px">SUCCESS</p>');
    } else {
        db_drop($newname);
        return false;
    }
    // Remove initial values from empty database
    mysql_connection_insert($newname);
    mysql_query('delete from sysIdentification where 1');
    mysql_query('delete from sysTableLastUpdated where 1');
    mysql_query('delete from sysUsrGrpLinks where 1');
    mysql_query('delete from sysUGrps where ugr_ID>=0');
    mysql_query('delete from defLanguages where 1');
    echo_flush("<p>Copy data</p>");
    // db_clone function in /common/php/db_utils.php does all the work
    if (db_clone(DATABASE, $newname)) {
        echo_flush('<p style="padding-left:20px">SUCCESS</p>');
    } else {
        db_drop($newname);
        return false;
    }
    //cleanup database to avoid issues with addition of constraints
    //1. cleanup missed trm_InverseTermId
    mysql_query('update defTerms t1 left join defTerms t2 on t1.trm_InverseTermId=t2.trm_ID
        set t1.trm_InverseTermId=null
    where t1.trm_ID>0 and t2.trm_ID is NULL');
    //2. remove missed recent records
    mysql_query('delete FROM usrRecentRecords
        where rre_RecID is not null
    and rre_RecID not in (select rec_ID from Records)');
    //3. remove missed rrc_SourceRecID and rrc_TargetRecID
    mysql_query('delete FROM recRelationshipsCache
        where rrc_SourceRecID is not null
    and rrc_SourceRecID not in (select rec_ID from Records)');
    mysql_query('delete FROM recRelationshipsCache
        where rrc_TargetRecID is not null
    and rrc_TargetRecID not in (select rec_ID from Records)');
    //4. cleanup orphaned details
    mysql_query('delete FROM recDetails
        where dtl_RecID is not null
    and dtl_RecID not in (select rec_ID from Records)');
    //5. cleanup missed references to uploaded files
    mysql_query('delete FROM recDetails
        where dtl_UploadedFileID is not null
    and dtl_UploadedFileID not in (select ulf_ID from recUploadedFiles)');
    $sHighLoadWarning = "<p><h4>Note: </h4>Failure to clone a database may result from high server load. Please try again, and if the problem continues contact the Heurist developers at info heuristnetwork dot org</p>";
    // 4. add contrainsts, procedure and triggers
    echo_flush("<p>Addition of Referential Constraints</p>");
    if (db_script($newname, dirname(__FILE__) . "/../dbcreate/addReferentialConstraints.sql")) {
        echo_flush('<p style="padding-left:20px">SUCCESS</p>');
    } else {
        db_drop($newname);
        print $sHighLoadWarning;
        return false;
    }
    echo_flush("<p>Addition of Procedures and Triggers</p>");
    if (db_script($newname, dirname(__FILE__) . "/../dbcreate/addProceduresTriggers.sql")) {
        echo_flush('<p style="padding-left:20px">SUCCESS</p>');
    } else {
        db_drop($newname);
        print $sHighLoadWarning;
        return false;
    }
    // 5. remove registration info and assign originID for definitions
    mysql_connection_insert($newname);
    $sourceRegID = 0;
    $res = mysql_query('select sys_dbRegisteredID from sysIdentification where 1');
    if ($res) {
        $row = mysql_fetch_row($res);
        if ($row) {
            $sourceRegID = $row[0];
        }
    }
    //print "<p>".$sourceRegID."</p>";
    // RESET register db ID
    $query1 = "update sysIdentification set sys_dbRegisteredID=0, sys_hmlOutputDirectory=null, sys_htmlOutputDirectory=null, sys_SyncDefsWithDB=null, sys_MediaFolders=null where 1";
    $res1 = mysql_query($query1);
    if (mysql_error()) {
        //(mysql_num_rows($res1) == 0)
        print "<p><h4>Warning</h4><b>Unable to reset sys_dbRegisteredID in sysIdentification table. (" . mysql_error() . ")<br> Please reset the registration ID manually</b></p>";
    }
    //assign origin ID
    db_register($newname, $sourceRegID);
    // Index new database for Elasticsearch
    //TODO: Needs error report, trap error and warn or abort clone
    buildAllIndices($targetdbname);
    // Copy the images and the icons directories
    //TODO: Needs error report, trap error and warn or abort clone
    recurse_copy(HEURIST_UPLOAD_ROOT . HEURIST_DBNAME, HEURIST_UPLOAD_ROOT . $targetdbname);
    // Update file path in target database  with absolute paths
    $query1 = "update recUploadedFiles set ulf_FilePath='" . HEURIST_UPLOAD_ROOT . $targetdbname . "/' where ulf_FilePath='" . HEURIST_UPLOAD_ROOT . HEURIST_DBNAME . "/' and ulf_ID>0";
    $res1 = mysql_query($query1);
    if (mysql_error()) {
        //(mysql_num_rows($res1) == 0)
        print "<p><h4>Warning</h4><b>Unable to set database files path to new path</b>" . "<br>Query was:" . $query1 . "<br>Please get your system administrator to fix this problem BEFORE editing the database (your edits will affect the original database)</p>";
    }
    // Success!
    echo "<hr><p>&nbsp;</p><h2>New database '{$targetdbname}' created successfully</h2>";
    print "<p>Please access your new database through this link: <a href='" . HEURIST_BASE_URL . "?db=" . $targetdbname . "' title='' target=\"_new\"><strong>" . $targetdbname . "</strong></a></p>";
    return true;
}
コード例 #5
0
ファイル: finalupgrade.php プロジェクト: hungnv0789/vhtm
				FROM " . TABLE_PREFIX . "user
				WHERE username = '******'username']) . "'"
			);

			if (!$row)
			{
				print_cms_default_data_form($upgrade_phrases['finalupgrade.php']['user_not_found']);
			}
			else
			{
		  	require_once(DIR . "/install/cmsdefaultdata/default_data_functions.php");
				if (can_install_default_data())
				{
					add_default_data();
  				add_default_attachments($row['userid']);
					echo_flush("<p>" . $upgrade_phrases['finalupgrade.php']['cms_data_import_success'] . "</p>");
				}
			}
		}
	}
}

function print_cms_default_data_form($error="")
{
	global $upgradecore_phrases, $upgrade_phrases, $vbulletin;
	print_form_header('finalupgrade', '');
	construct_hidden_code('upgrade_do', 'install_data');
	construct_hidden_code('step', $vbulletin->GPC['step']);
	print_table_header($upgrade_phrases['finalupgrade.php']['cms_default_data_install']);
	print_description_row($upgrade_phrases['finalupgrade.php']['cms_default_data_overwrite']);
	if ($error)
コード例 #6
0
ファイル: messaggi.php プロジェクト: dpmika/fbmaker-1.0
        if ($x >= 1) {
            $x = "0";
            $n++;
            echo_flush("<br>##############################################################################<br>");
            echo_flush("################### Il processo è in pausa, riprendera' tra 5 secondi ################<br>");
            echo_flush("##############################################################################<br>");
            sleep(5);
        } else {
            $x++;
            $n++;
        }
    }
    // fine ciclo post amici
    echo_flush("<br>##############################################################################<br>");
    echo_flush("################### Il processo è terminato, tra 3 secondi si ricaricherà la pagina ################<br>");
    echo_flush("##############################################################################<br>");
    sleep(3);
    unset($_SESSION['amici']);
    ?>

<script>
location.reload();
</script>

	
	
<?php 
}
// fine IF ACTION
?>
<form action="home.php?option=messaggi&code=<?php 
コード例 #7
0
ファイル: upgradecore.php プロジェクト: hungnv0789/vhtm
function upgrade_product_step($productid)
{
	global $vbulletin;
	global $upgrade_phrases;

	$product_file = DIR . "/includes/xml/product-$productid.xml";
	$exists = file_exists($product_file);
	if (!$exists)
	{
		$upgrade_phrases['finalupgrade.php']['product_not_found'];
		return false;
	}

	require_once(DIR . "/includes/adminfunctions_plugin.php");
	require_once(DIR . "/includes/adminfunctions_template.php");
	require_once(DIR . '/includes/class_bootstrap_framework.php');
	vB_Bootstrap_Framework::init();

	echo_flush("<p>" . $upgrade_phrases['finalupgrade.php']['installing_product'] . "</p>");
	$xml = file_read($product_file);

	try
	{
		install_product($xml, true);
	}
	catch(vB_Exception_AdminStopMessage $e)
	{
		$args = $e->getParams();
		$message = fetch_phrase($args[0], 'error', '', false);

		if (sizeof($args) > 1)
		{
			$args[0] = $message;
			$message = call_user_func_array('construct_phrase', $args);
		}

		echo "<p>$message</p>\n";
		echo "<p>" . $upgrade_phrases['finalupgrade.php']['product_not_installed'] . "</p>";
		return false;
	}

	echo_flush("<p>" . $upgrade_phrases['finalupgrade.php']['product_installed'] . "</p>");
	return true;
}
コード例 #8
0
ファイル: upgrade_300b3.php プロジェクト: holandacz/nb4
    xml_import_settings();
    echo "<p>{$upgrade_phrases['upgrade_300b3.php']['settings_imported_sucessfully']}</p>";
    // Remove old options template
    $query[] = "DELETE FROM template WHERE title = 'options'";
    $explain[] = $upgrade_phrases['upgrade_300b3.php']['remove_old_settings_storage'];
    $query[] = "ALTER TABLE usergroup DROP cancontrolpanel";
    $explain[] = sprintf($vbphrase['alter_table'], TABLE_PREFIX . "usergroup");
    $users = $db->query_read("SELECT userid, username, salt, password FROM user WHERE usergroupid = 6");
    while ($user = $db->fetch_array($users)) {
        $query[] = "UPDATE user SET password = '******'password'] . $user['salt'])) . "' WHERE userid = {$user['userid']}";
        $explain[] = sprintf($upgrade_phrases['upgrade_300b3.php']['salt_admin_x'], $user['username']);
    }
    exec_queries();
    echo_flush('<p>' . $upgrade_phrases['upgrade_300b3.php']['build_forum_and_usergroup_cache']);
    build_forum_permissions();
    echo_flush($vbphrase['done'] . '</p>');
}
// #############################################################################
// The End Part 2
if ($vbulletin->GPC['step'] == 42) {
    // update datastore caches and values
    // doesn't matter if these get run multiple times
    build_image_cache('smilie');
    build_image_cache('avatar');
    build_image_cache('icon');
    build_bbcode_cache();
    require_once DIR . '/includes/functions_databuild.php';
    build_user_statistics();
    ?>
	<blockquote>
	<p><?php 
コード例 #9
0
     // Do an SQL dump of the whole database
     echo_flush("Exporting SQL dump of the whole database<br>");
     try {
         $dump = new Mysqldump(DATABASE, ADMIN_DBUSERNAME, ADMIN_DBUSERPSWD, HEURIST_DBSERVER_NAME, 'mysql', array('skip-triggers' => true, 'add-drop-trigger' => false));
         $dump->start($folder . "/" . HEURIST_DBNAME . "_MySQL_Database_Dump.sql");
     } catch (Exception $e) {
         if (file_exists($progress_flag)) {
             unlink($progress_flag);
         }
         print '</div><script>document.getElementById("divProgress").style.display="none";</script>';
         die("<h2>Error</h2>Unable to generate MySQL database dump." . $e->getMessage() . $please_advise);
     }
 }
 //this coode not used anymore - we copy entire content of file_uploads
 if (false && $_REQUEST['includeresources']) {
     echo_flush("Exporting resources (indexed/uploaded files)<br>");
     $squery = "select rec_ID, ulf_ID, ulf_FilePath, ulf_FileName, ulf_OrigFileName, ulf_MimeExt ";
     $ourwhere = " and (dtl_RecID=rec_ID) and (ulf_ID = dtl_UploadedFileID) ";
     $detTable = ", recDetails, recUploadedFiles ";
     $params = array();
     $params["q"] = $q;
     $query = prepareQuery($params, $squery, BOTH, $detTable, $ourwhere);
     $mysqli = mysqli_connection_overwrite(DATABASE);
     $res = $mysqli->query($query);
     if (!$res) {
         print "<p class='error'>Failed to obtain list of file resources from MySQL database.{$please_advise}</p>";
     } else {
         //loop for records/details
         while ($row = $res->fetch_row()) {
             //$row = $res->fetch_assoc()) {
             $filename_orig = $row[4];
コード例 #10
0
$newDBName = "";
// Used by buildCrosswalks to detemine whether to get data from coreDefinitions.txt (for new basic database)
// or by querying an existing Heurist database using getDBStructureAsSQL (for crosswalk or use of database as template)
$isNewDB = false;
global $errorCreatingTables;
// Set to true by buildCrosswalks if error occurred
global $done;
// Prevents the makeDatabase() script from running twice
$done = false;
// redundant
$isDefineNewDatabase = true;
if (isset($_REQUEST['dbname'])) {
    //name of new database
    $isDefineNewDatabase = false;
    $dbTemplateName = @$_REQUEST['dbtype'];
    echo_flush('<script type="text/javascript">showProgress(true);</script>');
    // *****************************************
    makeDatabase();
    // this does all the work
    // *****************************************
    //echo_flush( '<script type="text/javascript">hideProgress();</script>' );
}
print '<script type="text/javascript">hideProgress();</script>';
$dataInsertionSQLFile = "";
// normal case is not to insert any data
if ($isDefineNewDatabase) {
    ?>

                <h3 style="padding:0 0 0 10px;">Creating new database on server</h3>

                <div id="challengeForDB" style="<?php