本文整理汇总了PHP中vbflush函数的典型用法代码示例。如果您正苦于以下问题:PHP vbflush函数的具体用法?PHP vbflush怎么用?PHP vbflush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vbflush函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: message
/**
* Displays a message.
*/
public function message($text, $red = 0, $crlf = 1, $delay = 1)
{
if (!$red) {
$line = "<center>{$text}</center>";
} else {
$line = "<center><font color=\"red\">{$text}</font></center>";
}
echo $line . str_repeat('<br />', $crlf);
vbflush();
sleep($delay);
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:14,代码来源:product.php
示例2: print_dots_stop
/**
* Prints a javascript code block that will halt the progress meter started with print_dots_start()
*/
function print_dots_stop()
{
if (defined('NO_IMPORT_DOTS')) {
return;
}
vbflush();
?>
<script type="text/javascript"><!--
if (document.all)
{
clearTimeout(jstimer);
}
//--></script>
<?php
vbflush();
}
开发者ID:benyamin20,项目名称:vbregistration,代码行数:19,代码来源:adminfunctions.php
示例3: echo_flush
function echo_flush($string)
{
echo $string;
vbflush();
}
开发者ID:benyamin20,项目名称:vbregistration,代码行数:5,代码来源:upgradecore.php
示例4: xml_import_template_groups
function xml_import_template_groups($styleid, $product, $templategroup_array, $output_group_name)
{
global $vbulletin, $vbphrase;
$safe_product = $vbulletin->db->escape_string($product);
$querytemplates = 0;
foreach ($templategroup_array AS $templategroup)
{
if (empty($templategroup['template'][0]))
{
$tg = array($templategroup['template']);
}
else
{
$tg = &$templategroup['template'];
}
if ($output_group_name)
{
echo '<p>' . construct_phrase($vbphrase['template_group_x'], $templategroup['name']) . '</p>';
vbflush();
}
foreach($tg AS $template)
{
$title = $vbulletin->db->escape_string($template['name']);
$template['username'] = $vbulletin->db->escape_string($template['username']);
$template['version'] = $vbulletin->db->escape_string($template['version']);
if ($template['templatetype'] != 'template')
{
// template is a special template == not compiled.
$uncompiled = '';
$compiled = $vbulletin->db->escape_string($template['value']);
}
else
{
//template is a regular template, do the compile and save the original.
$uncompiled = $vbulletin->db->escape_string($template['value']);
$compiled = $vbulletin->db->escape_string(compile_template($template['value']));
}
$querybits[] = "($styleid, '$template[templatetype]', '$title', '$compiled', '$uncompiled', " .
"$template[date], '$template[username]', '$template[version]', " .
"'$safe_product')";
if (++$querytemplates % 20 == 0)
{
/*insert query*/
$vbulletin->db->query_write("
REPLACE INTO " . TABLE_PREFIX . "template
(styleid, templatetype, title, template, template_un, dateline, username, version, product)
VALUES
" . implode(',', $querybits) . "
");
$querybits = array();
}
// Send some output to the browser inside this loop so certain hosts
// don't artificially kill the script. See bug #34585
echo ' ';
vbflush();
}
}
// insert any remaining templates
if (!empty($querybits))
{
/*insert query*/
$vbulletin->db->query_write("
REPLACE INTO " . TABLE_PREFIX . "template
(styleid, templatetype, title, template, template_un, dateline, username, version, product)
VALUES
" . implode(',', $querybits) . "
");
$querybits = array();
}
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:79,代码来源:adminfunctions_template.php
示例5: output_merge_conflict
/**
* If output is enabled, called to output info about a failed merge.
*
* @param array Array of template info. Record returned by data method.
*/
protected function output_merge_conflict($template_info)
{
global $vbphrase;
echo "<div>" . construct_phrase($vbphrase['template_conflict_x_y'], $template_info['title'], $template_info['styleid']) . "</div>";
// Send some output to browser. See bug #34585
vbflush();
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:13,代码来源:class_template_merge.php
示例6: post_install
/**
* Everything that comes after the install - no reason to break this up into chunks at present
*
*/
public function post_install()
{
// dependencies checked, install code run. Now clear out the old product info;
// settings should be retained in memory already
delete_product($this->productinfo['productid'], false, true);
$codes =& $this->productobj['codes']['code'];
if (!isset($codes[0])) {
$codes = array($codes);
}
if (is_array($codes)) {
// we've now run all the codes, if execution is still going
// then it's going to complete fully, so insert the codes
foreach ($codes as $code) {
/* insert query */
$this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "productcode\n\t\t\t\t\t\t(productid, version, installcode, uninstallcode)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . $this->db->escape_string($this->productinfo['productid']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($code['version']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($code['installcode']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($code['uninstallcode']) . "')\n\t\t\t\t");
}
}
if (is_array($this->productobj['dependencies']['dependency'])) {
$dependencies =& $this->productobj['dependencies']['dependency'];
if (!isset($dependencies[0])) {
$dependencies = array($dependencies);
}
// dependencies met, codes run -- now we can insert the dependencies into the DB
foreach ($dependencies as $dependency) {
/* insert query */
$this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "productdependency\n\t\t\t\t\t\t(productid, dependencytype, parentproductid, minversion, maxversion)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . $this->db->escape_string($this->productinfo['productid']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($dependency['dependencytype']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($dependency['parentproductid']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($dependency['minversion']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($dependency['maxversion']) . "')\n\t\t\t\t");
}
}
/* insert query */
$this->db->query_write("\n\t\t\tINSERT INTO " . TABLE_PREFIX . "product\n\t\t\t\t(productid, title, description, version, active, url, versioncheckurl)\n\t\t\tVALUES\n\t\t\t\t('" . $this->db->escape_string($this->productinfo['productid']) . "',\n\t\t\t\t'" . $this->db->escape_string($this->productinfo['title']) . "',\n\t\t\t\t'" . $this->db->escape_string($this->productinfo['description']) . "',\n\t\t\t\t'" . $this->db->escape_string($this->productinfo['version']) . "',\n\t\t\t\t" . intval($this->active) . ",\n\t\t\t\t'" . $this->db->escape_string($this->productinfo['url']) . "',\n\t\t\t\t'" . $this->db->escape_string($this->productinfo['versioncheckurl']) . "')\n\t\t");
// ############## import templates
if (!empty($this->productobj['templates']['template']) and is_array($this->productobj['templates']['template'])) {
$querybits = array();
$querytemplates = 0;
$templates =& $this->productobj['templates']['template'];
if (!isset($templates[0])) {
$templates = array($templates);
}
foreach ($templates as $template) {
$title = $this->db->escape_string($template['name']);
$template['template'] = $this->db->escape_string($template['value']);
$template['username'] = $this->db->escape_string($template['username']);
$template['templatetype'] = $this->db->escape_string($template['templatetype']);
$template['date'] = intval($template['date']);
if ($template['templatetype'] != 'template') {
// template is a special template
$querybits[] = "(-1, '{$template['templatetype']}', '{$title}', '{$template['template']}', '', {$template['date']}, '{$template['username']}', '" . $this->db->escape_string($template['version']) . "', '" . $this->db->escape_string($this->productinfo['productid']) . "')";
} else {
// template is a standard template
$querybits[] = "(-1, '{$template['templatetype']}', '{$title}', '" . $this->db->escape_string(compile_template($template['value'])) . "', '{$template['template']}', {$template['date']}, '{$template['username']}', '" . $this->db->escape_string($template['version']) . "', '" . $this->db->escape_string($this->productinfo['productid']) . "')";
}
if (++$querytemplates % 20 == 0) {
/*insert query*/
$this->db->query_write("\n\t\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "template\n\t\t\t\t\t\t\t(styleid, templatetype, title, template, template_un, dateline, username, version, product)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t" . implode(',', $querybits) . "\n\t\t\t\t\t");
$querybits = array();
}
if (!defined('SUPPRESS_KEEPALIVE_ECHO')) {
echo ' ';
vbflush();
}
}
// insert any remaining templates
if (!empty($querybits)) {
/*insert query*/
$this->db->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "template\n\t\t\t\t\t\t(styleid, templatetype, title, template, template_un, dateline, username, version, product)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t" . implode(',', $querybits) . "\n\t\t\t\t");
}
unset($querybits);
$rebuild['templates'] = true;
}
if (is_array($this->productobj['templates_mobile']['template'])) {
$querybits = array();
$querytemplates = 0;
$templates =& $this->productobj['templates_mobile']['template'];
if (!isset($templates[0])) {
$templates = array($templates);
}
foreach ($templates as $template) {
$title = $this->db->escape_string($template['name']);
$template['template'] = $this->db->escape_string($template['value']);
$template['username'] = $this->db->escape_string($template['username']);
$template['templatetype'] = $this->db->escape_string($template['templatetype']);
$template['date'] = intval($template['date']);
if ($template['templatetype'] != 'template') {
// template is a special template
$querybits[] = "(-2, '{$template['templatetype']}', '{$title}', '{$template['template']}', '', {$template['date']}, '{$template['username']}', '" . $this->db->escape_string($template['version']) . "', '" . $this->db->escape_string($this->productinfo['productid']) . "')";
} else {
// template is a standard template
$querybits[] = "(-2, '{$template['templatetype']}', '{$title}', '" . $this->db->escape_string(compile_template($template['value'])) . "', '{$template['template']}', {$template['date']}, '{$template['username']}', '" . $this->db->escape_string($template['version']) . "', '" . $this->db->escape_string($this->productinfo['productid']) . "')";
}
if (++$querytemplates % 20 == 0) {
/*insert query*/
$this->db->query_write("\n\t\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "template\n\t\t\t\t\t\t\t(styleid, templatetype, title, template, template_un, dateline, username, version, product)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t" . implode(',', $querybits) . "\n\t\t\t\t\t");
$querybits = array();
}
if (!defined('SUPPRESS_KEEPALIVE_ECHO')) {
echo ' ';
//.........这里部分代码省略.........
开发者ID:0hyeah,项目名称:yurivn,代码行数:101,代码来源:class_upgrade_product.php
示例7: phpDump
function phpDump()
{
/* Entire Table Dump */
if ($this->TYPE) {
// Predefined Variables
$tables = array();
$lock = 'LOCK TABLES';
$unlock = 'UNLOCK TABLES;';
// Store Table List
foreach ($this->TABLES as $table) {
$tables[] = $table;
$lock .= ' `' . $table . '` READ,';
}
// Remove Ending of LockList
$lock = rtrim($lock, ",") . ';';
// Lock Tables
if ($this->LOCK) {
$this->MYSQL->query($lock);
}
if ($this->COMBINE) {
$this->FILE = $this->FULL_PATH . '-full-backup.sql';
$this->createFile($this->FILE);
}
// Start Parsing Rows
foreach ($tables as $table) {
// Create a New File
if (!$this->COMBINE) {
$this->FILE = $this->FULL_PATH . '-' . $table . '.sql';
$this->createFile($this->FILE);
}
// Open Output
if (!($output = @fopen($this->FILE, 'a'))) {
$this->throwError(DUMP_ERROR, "Could not open Destination SQL file for writing.");
}
// Set Write Buffer
@stream_set_write_buffer($output, 0);
// InnoDb Optimization
if ($this->INNODB) {
// Construct AutoCommit Off
fwrite($output, "SET AUTOCOMMIT = 0;\n");
// Construct Foreign Key Checks Off
fwrite($output, "SET FOREIGN_KEY_CHECKS = 0;\n\n\n");
}
// Create Header
$tableheader = $this->MYSQL->query_first("SHOW CREATE TABLE `{$table}`");
$tableheader = "DROP TABLE IF EXISTS `{$table}`;\n" . $tableheader['Create Table'] . ";\n\n";
// Write Header
fwrite($output, $tableheader);
// Get Total Rows
$total = $this->MYSQL->query_first("SELECT COUNT(*) AS count FROM `{$table}`");
echo "Processing " . $table . " : Total Rows = " . $total['count'] . "<br />";
vbflush();
// Check Total & Skip
if (intval($total['count']) == 0) {
continue;
}
// Get Row (Unbuffered)
$rows = $this->MYSQL->query_read("SELECT * FROM `{$table}`", false);
// Fields
$fields = $this->MYSQL->num_fields($rows);
// MySQL4+ Optimizations, Construct Disable Keys
fwrite($output, "/*!40000 ALTER TABLE `{$table}` DISABLE KEYS */;\n");
// Get Data
$r = 0;
while ($row = $this->MYSQL->fetch_array($rows, DBARRAY_NUM)) {
$values = array();
for ($i = 0; $i < $fields; $i++) {
// Check Data
if (!isset($row[$i]) || is_null($row[$i])) {
$values[] = 'NULL';
} else {
$values[] = "'" . $this->MYSQL->escape_string($row[$i]) . "'";
}
}
$r++;
// Construct Insert
fwrite($output, "INSERT INTO `{$table}` VALUES (" . implode(',', $values) . ");\n");
}
// MySQL4+ Optimizations, Construct Enable Keys
fwrite($output, "/*!40000 ALTER TABLE `{$table}` ENABLE KEYS */;\n\n");
// InnoDb Optimization
if ($this->INNODB) {
// Construct AutoCommit On
fwrite($output, "\n" . "SET AUTOCOMMIT = 1;\n");
// Construct Commit
fwrite($output, "COMMIT;\n");
// Construct Foreign Key Checks On
fwrite($output, "SET FOREIGN_KEY_CHECKS = 1;\n\n\n");
}
// Close Output
@fclose($output);
// Free Memory
$this->MYSQL->free_result($rows);
}
// Unlock Tables
if ($this->LOCK) {
$this->MYSQL->query($unlock);
}
}
}
开发者ID:holandacz,项目名称:nb4,代码行数:100,代码来源:mysqlbackup.php
示例8: do_prune_post_edit_histories
function do_prune_post_edit_histories($histories)
{
global $vbphrase, $db;
$postids = array();
echo '<p><b>' . $vbphrase['deleting_post_edit_histories'] . '</b>';
while ($history = $db->fetch_array($histories))
{
$postids[] = $history['postid'];
}
while(count($postids))
{
// work in batches of 1000 at a time
$to_delete = array_slice($postids, 0, 1000);
$delete_query = "
DELETE FROM " . TABLE_PREFIX . "postedithistory
WHERE postid IN ( " . implode(',', $to_delete) . " )
";
$db->query_write($delete_query);
// Remove the history links
$update_query = "
UPDATE " . TABLE_PREFIX . "editlog
SET hashistory = 0
WHERE hashistory != 0
AND postid IN ( " . implode(',', $to_delete) . " )
";
$db->query_write($update_query);
echo ".";
vbflush();
// remove the 1000 from our $postids array
$postids = array_splice($postids, 1000);
}
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:34,代码来源:thread.php
示例9: output_merge_conflict
/**
* If output is enabled, called to output info about a failed merge.
*
* @param array Array of template info. Record returned by data method.
*/
protected function output_merge_conflict($template_info)
{
global $vbphrase;
if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') {
echo '<div>' . construct_phrase($vbphrase['template_conflict_x_y'], $template_info['title'], $template_info['styleid']) . '</div>';
// Send some output to browser. See bug #34585
vbflush();
} else {
return construct_phrase($vbphrase['template_conflict_x_y'], $template_info['title'], $template_info['styleid']);
}
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:16,代码来源:class_template_merge.php
示例10: install_product
//.........这里部分代码省略.........
}
/* insert query */
$assertor->insert('product', array('productid' => $info['productid'], 'title' => $info['title'], 'description' => $info['description'], 'version' => $info['version'], 'active' => intval($active), 'url' => $info['url'], 'versioncheckurl' => $info['versioncheckurl']));
// ############## import templates
if (isset($arr['templates']['template']) and is_array($arr['templates']['template'])) {
$querybits = array();
$querytemplates = 0;
$templates =& $arr['templates']['template'];
if (!isset($templates[0])) {
$templates = array($templates);
}
foreach ($templates as $template) {
$title = $template['name'];
$template['template'] = $template['value'];
$template['username'] = $template['username'];
$template['templatetype'] = $template['templatetype'];
$template['date'] = intval($template['date']);
if ($template['templatetype'] != 'template') {
// template is a special template
$querybits[] = array('styleid' => -1, 'templatetype' => $template['templatetype'], 'title' => $title, 'template' => $template['template'], 'template_un' => '', 'dateline' => $template['date'], 'username' => $template['username'], 'version' => $template['version'], 'product' => $info['productid']);
} else {
// template is a standard template
$querybits[] = array('styleid' => -1, 'templatetype' => $template['templatetype'], 'title' => $title, 'template' => compile_template($template['value']), 'template_un' => $template['template'], 'dateline' => $template['date'], 'username' => $template['username'], 'version' => $template['version'], 'product' => $info['productid']);
}
if (++$querytemplates % 20 == 0) {
/*insert query*/
$assertor->assertQuery('replaceValues', array('values' => $querybits, 'table' => 'template'));
$querybits = array();
}
// Send some output to the browser inside this loop so certain hosts
// don't artificially kill the script. See bug #34585
if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') {
echo ' ';
vbflush();
}
}
// insert any remaining templates
if (!empty($querybits)) {
/*insert query*/
$assertor->assertQuery('replaceValues', array('values' => $querybits, 'table' => 'template'));
}
unset($querybits);
$rebuild['templates'] = true;
}
// ############## import stylevars
if (isset($arr['stylevardfns']['stylevargroup']) and is_array($arr['stylevardfns']['stylevargroup'])) {
xml_import_stylevar_definitions($arr['stylevardfns'], $info['productid']);
}
if (!empty($arr['stylevars']) and is_array($arr['stylevars']) and is_array($arr['stylevars']['stylevar'])) {
xml_import_stylevars($arr['stylevars'], -1);
}
// ############## import hooks
if (isset($arr['hooks']['hook']) and is_array($arr['hooks']['hook'])) {
$hooks =& $arr['hooks']['hook'];
if (!isset($hooks[0])) {
$hooks = array($hooks);
}
foreach ($hooks as $hook) {
$hook['product'] = $info['productid'];
$assertor->insert('hook', $hook);
}
$rebuild['hooks'] = true;
}
// ############## import phrases
if (isset($arr['phrases']['phrasetype']) and is_array($arr['phrases']['phrasetype'])) {
require_once DIR . '/includes/adminfunctions_language.php';
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:67,代码来源:adminfunctions_product.php
示例11: install_product
//.........这里部分代码省略.........
{
$title = $db->escape_string($template['name']);
$template['template'] = $db->escape_string($template['value']);
$template['username'] = $db->escape_string($template['username']);
$template['templatetype'] = $db->escape_string($template['templatetype']);
$template['date'] = intval($template['date']);
if ($template['templatetype'] != 'template')
{
// template is a special template
$querybits[] = "(-1, '$template[templatetype]', '$title', '$template[template]', '', $template[date], '$template[username]', '" . $db->escape_string($template['version']) . "', '" . $db->escape_string($info['productid']) . "')";
}
else
{
// template is a standard template
$querybits[] = "(-1, '$template[templatetype]', '$title', '" . $db->escape_string(compile_template($template['value'])) . "', '$template[template]', $template[date], '$template[username]', '" . $db->escape_string($template['version']) . "', '" . $db->escape_string($info['productid']) . "')";
}
if (++$querytemplates % 20 == 0)
{
/*insert query*/
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "template
(styleid, templatetype, title, template, template_un, dateline, username, version, product)
VALUES
" . implode(',', $querybits) . "
");
$querybits = array();
}
// Send some output to the browser inside this loop so certain hosts
// don't artificially kill the script. See bug #34585
echo ' ';
vbflush();
}
// insert any remaining templates
if (!empty($querybits))
{
/*insert query*/
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "template
(styleid, templatetype, title, template, template_un, dateline, username, version, product)
VALUES
" . implode(',', $querybits) . "
");
}
unset($querybits);
$rebuild['templates'] = true;
}
// ############## import stylevars
if (is_array($arr['stylevardfns']['stylevargroup']))
{
xml_import_stylevar_definitions($arr['stylevardfns'], $info['productid']);
}
if (is_array($arr['stylevars']['stylevar']))
{
xml_import_stylevars($arr['stylevars'], -1);
}
// ############## import hooks/plugins
if (is_array($arr['plugins']['plugin']))
{
开发者ID:hungnv0789,项目名称:vhtm,代码行数:67,代码来源:adminfunctions_plugin.php
示例12: xml_import_templates
function xml_import_templates($templates, $masterstyleid, $info, &$rebuild)
{
global $vbulletin;
$querybits = array();
$querytemplates = 0;
if (!isset($templates[0])) {
$templates = array($templates);
}
foreach ($templates as $template) {
$title = $vbulletin->db->escape_string($template['name']);
$template['template'] = $vbulletin->db->escape_string($template['value']);
$template['username'] = $vbulletin->db->escape_string($template['username']);
$template['templatetype'] = $vbulletin->db->escape_string($template['templatetype']);
$template['date'] = intval($template['date']);
if ($template['templatetype'] != 'template') {
// template is a special template
$querybits[] = "({$masterstyleid}, '{$template['templatetype']}', '{$title}', '{$template['template']}', '', {$template['date']}, '{$template['username']}', '" . $vbulletin->db->escape_string($template['version']) . "', '" . $vbulletin->db->escape_string($info['productid']) . "')";
} else {
// template is a standard template
$querybits[] = "({$masterstyleid}, '{$template['templatetype']}', '{$title}', '" . $vbulletin->db->escape_string(compile_template($template['value'])) . "', '{$template['template']}', {$template['date']}, '{$template['username']}', '" . $vbulletin->db->escape_string($template['version']) . "', '" . $vbulletin->db->escape_string($info['productid']) . "')";
}
if (++$querytemplates % 20 == 0) {
/*insert query*/
$vbulletin->db->query_write("\n\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "template\n\t\t\t\t\t(styleid, templatetype, title, template, template_un, dateline, username, version, product)\n\t\t\t\tVALUES\n\t\t\t\t\t" . implode(',', $querybits) . "\n\t\t\t");
$querybits = array();
}
// Send some output to the browser inside this loop so certain hosts
// don't artificially kill the script. See bug #34585
if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') {
echo ' ';
vbflush();
}
}
// insert any remaining templates
if (!empty($querybits)) {
/*insert query*/
$vbulletin->db->query_write("\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "template\n\t\t\t\t(styleid, templatetype, title, template, template_un, dateline, username, version, product)\n\t\t\tVALUES\n\t\t\t\t" . implode(',', $querybits) . "\n\t\t");
}
unset($querybits);
$rebuild['templates'] = true;
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:41,代码来源:adminfunctions_template.php
示例13: rebuild_milestone_counters
/**
* Rebuilds all milestone counters.
*
* @param boolean True if you want to echo a "." for each milestone
*/
function rebuild_milestone_counters($echo = false)
{
global $vbulletin, $db;
$milestones = $db->query_read("\r\n\t\tSELECT *\r\n\t\tFROM " . TABLE_PREFIX . "pt_milestone\r\n\t");
while ($milestone = $db->fetch_array($milestones)) {
$milestonedata =& datamanager_init('Pt_Milestone', $vbulletin, ERRTYPE_SILENT);
$milestonedata->set_existing($milestone);
$milestonedata->rebuild_milestone_counters();
$milestonedata->save();
if ($echo) {
echo ' . ';
vbflush();
}
}
}
开发者ID:holandacz,项目名称:nb4,代码行数:20,代码来源:adminfunctions_projecttools.php
示例14: post_install
/**
* Everything that comes after the install - no reason to break this up into chunks at present
*
*/
public function post_install()
{
// dependencies checked, install code run. Now clear out the old product info;
// settings should be retained in memory already
delete_product($this->productinfo['productid'], false, true);
$codes =& $this->productobj['codes']['code'];
if (!isset($codes[0])) {
$codes = array($codes);
}
if (is_array($codes)) {
// we've now run all the codes, if execution is still going
// then it's going to complete fully, so insert the codes
foreach ($codes as $code) {
/* insert query */
$this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "productcode\n\t\t\t\t\t\t(productid, version, installcode, uninstallcode)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . $this->db->escape_string($this->productinfo['productid']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($code['version']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($code['installcode']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($code['uninstallcode']) . "')\n\t\t\t\t");
}
}
if (is_array($this->productobj['dependencies']['dependency'])) {
$dependencies =& $this->productobj['dependencies']['dependency'];
if (!isset($dependencies[0])) {
$dependencies = array($dependencies);
}
// dependencies met, codes run -- now we can insert the dependencies into the DB
foreach ($dependencies as $dependency) {
/* insert query */
$this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "productdependency\n\t\t\t\t\t\t(productid, dependencytype, parentproductid, minversion, maxversion)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . $this->db->escape_string($this->productinfo['productid']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($dependency['dependencytype']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($dependency['parentproductid']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($dependency['minversion']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($dependency['maxversion']) . "')\n\t\t\t\t");
}
}
/* insert query */
$this->db->query_write("\n\t\t\tINSERT INTO " . TABLE_PREFIX . "product\n\t\t\t\t(productid, title, description, version, active, url, versioncheckurl)\n\t\t\tVALUES\n\t\t\t\t('" . $this->db->escape_string($this->productinfo['productid']) . "',\n\t\t\t\t'" . $this->db->escape_string($this->productinfo['title']) . "',\n\t\t\t\t'" . $this->db->escape_string($this->productinfo['description']) . "',\n\t\t\t\t'" . $this->db->escape_string($this->productinfo['version']) . "',\n\t\t\t\t" . intval($this->active) . ",\n\t\t\t\t'" . $this->db->escape_string($this->productinfo['url']) . "',\n\t\t\t\t'" . $this->db->escape_string($this->productinfo['versioncheckurl']) . "')\n\t\t");
// ############## import templates
if (is_array($this->productobj['templates']['template'])) {
$querybits = array();
$querytemplates = 0;
$templates =& $this->productobj['templates']['template'];
if (!isset($templates[0])) {
$templates = array($templates);
}
foreach ($templates as $template) {
$querybit = array('styleid' => '-1', 'title' => $template['name'], 'template' => $template['templatetype'] == 'template' ? compile_template($template['value']) : $template['value'], 'template_un' => $template['templatetype'] == 'template' ? $template['value'] : '', 'dateline' => $template['date'], 'username' => $template['username'], 'version' => $template['version'], 'product' => $template['productid']);
$querybit['templatetype'] = $template['templatetype'];
$querybits[] = $querybit;
if (++$querytemplates % 20 == 0) {
/*insert query*/
vB::getDbAssertor()->assertQuery('replaceTemplates', array('querybits' => $querybits));
$querybits = array();
}
if (!defined('SUPPRESS_KEEPALIVE_ECHO')) {
echo ' ';
vbflush();
}
}
// insert any remaining templates
if (!empty($querybits)) {
/*insert query*/
vB::getDbAssertor()->assertQuery('replaceTemplates', array('querybits' => $querybits));
}
unset($querybits);
$rebuild['templates'] = true;
}
// ############## import stylevars
if (isset($this->productobj['stylevardfns']['stylevargroup']) and is_array($this->productobj['stylevardfns']['stylevargroup'])) {
xml_import_stylevar_definitions($this->productobj['stylevardfns'], $this->productinfo['productid']);
}
if (isset($this->productobj['stylevars']['stylevar']) and is_array($this->productobj['stylevars']['stylevar'])) {
xml_import_stylevars($this->productobj['stylevars'], -1);
}
// ############## import hooks
if (is_array($this->productobj['hooks']['hook'])) {
$hooks =& $this->productobj['hooks']['hook'];
if (!isset($hooks[0])) {
$hooks = array($hooks);
}
foreach ($hooks as $hook) {
$hook['product'] = $this->productinfo['productid'];
$this->db->query_write(fetch_query_sql($hook, 'hook'));
}
$rebuild['hooks'] = true;
}
// ############## import phrases
if (is_array($this->productobj['phrases']['phrasetype'])) {
$master_phrasetypes = array();
$master_phrasefields = array();
foreach (vB_Api::instanceInternal('phrase')->fetch_phrasetypes(false) as $phrasetype) {
$master_phrasefields["{$phrasetype['fieldname']}"] = true;
}
$phrasetypes = vB_Api::instanceInternal('phrase')->fetch_phrasetypes(false);
if (!isset($phrasetypes[0])) {
$phrasetypes = array($phrasetypes);
}
foreach ($phrasetypes as $phrasetype) {
if (empty($phrasetype['phrase'])) {
continue;
}
if ($phrasetype['fieldname'] == '' or !preg_match('#^[a-z0-9_]+$#i', $phrasetype['fieldname'])) {
continue;
//.........这里部分代码省略.........
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:101,代码来源:class_upgrade_product.php
示例15: xml_import_style
/**
* Reads XML style file and imports data from it into the database
*
* @param string XML data
* @param integer Style ID
* @param integer Parent style ID
* @param string New style title
* @param boolean Allow vBulletin version mismatch
* @param integer Display order for new style
* @param boolean Allow user selection of new style
*/
function xml_import_style($xml = false, $styleid = -1, $parentid = -1, $title = '', $anyversion = false, $displayorder = 1, $userselect = true)
{
// $GLOBALS['path'] needs to be passed into this function or reference $vbulletin->GPC['path']
global $vbulletin, $vbphrase;
print_dots_start('<b>' . $vbphrase['importing_style'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
require_once DIR . '/includes/class_xml.php';
$xmlobj = new vB_XML_Parser($xml, $vbulletin->GPC['path']);
if ($xmlobj->error_no == 1) {
print_dots_stop();
print_stop_message('no_xml_and_no_path');
} else {
if ($xmlobj->error_no == 2) {
print_dots_stop();
print_stop_message('please_ensure_x_file_is_located_at_y', 'vbulletin-style.xml', $vbulletin->GPC['path']);
}
}
if (!($arr = $xmlobj->parse())) {
print_dots_stop();
print_stop_message('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line());
}
if (!$arr['templategroup']) {
print_dots_stop();
print_stop_message('invalid_file_specified');
}
$version = $arr['vbversion'];
$master = $arr['type'] == 'master' ? 1 : 0;
$title = empty($title) ? $arr['name'] : $title;
$product = empty($arr['product']) ? 'vbulletin' : $arr['product'];
$arr = $arr['templategroup'];
if (empty($arr[0])) {
$arr = array($arr);
}
$full_product_info = fetch_product_list(true);
$product_info = $full_product_info["{$product}"];
// version check
if ($version != $product_info['version'] and !$anyversion and !$master) {
print_dots_stop();
print_stop_message('upload_file_created_with_different_version', $product_info['version'], $version);
}
if ($master) {
// overwrite master style
echo "<h3>{$vbphrase['master_style']}</h3>\n<p>{$vbphrase['please_wait']}</p>";
vbflush();
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "template WHERE styleid = -10 AND (product = '" . $vbulletin->db->escape_string($product) . "'" . iif($product == 'vbulletin', " OR product = ''") . ")");
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "template SET styleid = -10 WHERE styleid = -1 AND (product = '" . $vbulletin->db->escape_string($product) . "'" . iif($product == 'vbulletin', " OR product = ''") . ")");
$styleid = -1;
} else {
if ($styleid == -1) {
// creating a new style
if ($test = $vbulletin->db->query_first("SELECT styleid FROM " . TABLE_PREFIX . "style WHERE title = '" . $vbulletin->db->escape_string($title) . "'")) {
print_dots_stop();
print_stop_message('style_already_exists', $title);
} else {
echo "<h3><b>" . construct_phrase($vbphrase['creating_a_new_style_called_x'], $title) . "</b></h3>\n<p>{$vbphrase['please_wait']}</p>";
vbflush();
/*insert query*/
$styleresult = $vbulletin->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "style\n\t\t\t\t\t(title, parentid, displayorder, userselect)\n\t\t\t\t\tVALUES\n\t\t\t\t\t('" . $vbulletin->db->escape_string($title) . "', {$parentid}, {$displayorder}, " . ($userselect ? 1 : 0) . ")\n\t\t\t\t");
$styleid = $vbulletin->db->insert_id($styleresult);
}
} else {
// overwriting an existing style
if ($getstyle = $vbulletin->db->query_first("SELECT title FROM " . TABLE_PREFIX . "style WHERE styleid = {$styleid}")) {
echo "<h3><b>" . construct_phrase($vbphrase['overwriting_style_x'], $getstyle['title']) . "</b></h3>\n<p>{$vbphrase['please_wait']}</p>";
vbflush();
} else {
print_dots_stop();
print_stop_message('cant_overwrite_non_existent_style');
}
}
}
// types array...
$types = array($vbphrase['template'], $vbphrase['stylevar'], $vbphrase['css'], $vbphrase['replacement_variable']);
$querybits = array();
$querytemplates = 0;
foreach ($arr as $templategroup) {
if (empty($templategroup['template'][0])) {
$tg = array($templategroup['template']);
} else {
$tg =& $templategroup['template'];
}
foreach ($tg as $template) {
$title = $vbulletin->db->escape_string($template['name']);
$template['template'] = $vbulletin->db->escape_string($template['value']);
$template['username'] = $vbulletin->db->escape_string($template['username']);
if ($template['templatetype'] != 'template') {
// template is a special template
$querybits[] = "({$styleid}, '{$template['templatetype']}', '{$title}', '{$template['template']}', '', {$template['date']}, '{$template['username']}', '" . $vbulletin->db->escape_string($template['version']) . "', '" . $vbulletin->db->escape_string($product) . "')";
} else {
// template is a standard template
//.........这里部分代码省略.........
开发者ID:holandacz,项目名称:nb4,代码行数:101,代码来源:adminfunctions_template.php
示例16: fetch_annotated_lines
public function fetch_annotated_lines()
{
$table = $this->fetch_table();
$result = array();
$data_old_key = $this->data_old_len - 1;
$data_new_key = $this->data_new_len - 1;
$old_line_num = $this->data_old_len;
// start at bottom right of table
$this_row = $this->decompress_row($table[$data_old_key]);
$above_row = $this->decompress_row($table[$data_old_key - 1]);
while ($data_old_key >= 0 and $data_new_key >= 0) {
// if up 1, left 1 is different and the position we're at has the same text...
if ($this_row[$data_new_key] != $above_row[$data_new_key - 1] and $this->data_old[$data_old_key] == $this->data_new[$data_new_key]) {
// ... this is an unchanged line. Add then move up 1, left 1.
array_unshift($result, array('data' => $this->data_old[$data_old_key], 'type' => 'unchanged', 'line' => $old_line_num));
$old_line_num--;
$data_old_key--;
$data_new_key--;
//we'll exit the loop on the next iteration anyw
|
请发表评论