当前位置: 首页>>代码示例>>PHP>>正文


PHP print_dots_stop函数代码示例

本文整理汇总了PHP中print_dots_stop函数的典型用法代码示例。如果您正苦于以下问题:PHP print_dots_stop函数的具体用法?PHP print_dots_stop怎么用?PHP print_dots_stop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了print_dots_stop函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: xml_import_help_topics

function xml_import_help_topics($xml = false)
{
    global $vbulletin, $vbphrase;
    print_dots_start('<b>' . $vbphrase['importing_admin_help'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
    require_once DIR . '/includes/class_xml.php';
    $xmlobj = new vB_XML_Parser($xml, $GLOBALS['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-adminhelp.xml', $GLOBALS['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['helpscript']) {
        print_dots_stop();
        print_stop_message('invalid_file_specified');
    }
    $product = empty($arr['product']) ? 'vbulletin' : $arr['product'];
    $has_phrases = !empty($arr['hasphrases']);
    $arr = $arr['helpscript'];
    if ($product == 'vbulletin') {
        $product_sql = "product IN ('vbulletin', '')";
    } else {
        $product_sql = "product = '" . $vbulletin->db->escape_string($product) . "'";
    }
    $vbulletin->db->query_write("\n\t\tDELETE FROM " . TABLE_PREFIX . "adminhelp\n\t\tWHERE {$product_sql}\n\t\t\t AND volatile = 1\n\t");
    if ($has_phrases) {
        $vbulletin->db->query_write("\n\t\t\tDELETE FROM " . TABLE_PREFIX . "phrase\n\t\t\tWHERE {$product_sql}\n\t\t\t\tAND fieldname = 'cphelptext'\n\t\t\t\tAND languageid = -1\n\t\t");
    }
    // Deal with single entry
    if (!is_array($arr[0])) {
        $arr = array($arr);
    }
    foreach ($arr as $helpscript) {
        $help_sql = array();
        $phrase_sql = array();
        $help_sql_len = 0;
        $phrase_sql_len = 0;
        // Deal with single entry
        if (!is_array($helpscript['helptopic'][0])) {
            $helpscript['helptopic'] = array($helpscript['helptopic']);
        }
        foreach ($helpscript['helptopic'] as $topic) {
            $help_sql[] = "\n\t\t\t\t('" . $vbulletin->db->escape_string($helpscript['name']) . "',\n\t\t\t\t'" . $vbulletin->db->escape_string($topic['act']) . "',\n\t\t\t\t'" . $vbulletin->db->escape_string($topic['opt']) . "',\n\t\t\t\t" . intval($topic['disp']) . ",\n\t\t\t\t1,\n\t\t\t\t'" . $vbulletin->db->escape_string($product) . "')\n\t\t\t";
            $help_sql_len += strlen(end($help_sql));
            if ($has_phrases) {
                $phrase_name = fetch_help_phrase_short_name(array('script' => $helpscript['name'], 'action' => $topic['act'], 'optionname' => $topic['opt']));
                if (isset($topic['text']['value'])) {
                    $phrase_sql[] = "\n\t\t\t\t\t\t(-1,\n\t\t\t\t\t\t'cphelptext',\n\t\t\t\t\t\t'{$phrase_name}_text',\n\t\t\t\t\t\t'" . $vbulletin->db->escape_string($topic['text']['value']) . "',\n\t\t\t\t\t\t'" . $vbulletin->db->escape_string($product) . "',\n\t\t\t\t\t\t'" . $vbulletin->db->escape_string($topic['text']['username']) . "',\n\t\t\t\t\t\t" . intval($topic['text']['date']) . ",\n\t\t\t\t\t\t'" . $vbulletin->db->escape_string($topic['text']['version']) . "')\n\t\t\t\t\t";
                    $phrase_sql_len += strlen(end($phrase_sql));
                }
                if (isset($topic['title']['value'])) {
                    $phrase_sql[] = "\n\t\t\t\t\t\t(-1,\n\t\t\t\t\t\t'cphelptext',\n\t\t\t\t\t\t'{$phrase_name}_title',\n\t\t\t\t\t\t'" . $vbulletin->db->escape_string($topic['title']['value']) . "',\n\t\t\t\t\t\t'" . $vbulletin->db->escape_string($product) . "',\n\t\t\t\t\t\t'" . $vbulletin->db->escape_string($topic['title']['username']) . "',\n\t\t\t\t\t\t" . intval($topic['title']['date']) . ",\n\t\t\t\t\t\t'" . $vbulletin->db->escape_string($topic['title']['version']) . "')\n\t\t\t\t\t";
                    $phrase_sql_len += strlen(end($phrase_sql));
                }
            }
            if ($phrase_sql_len > 102400) {
                // insert max of 100k of phrases at a time
                /*insert query*/
                $vbulletin->db->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "phrase\n\t\t\t\t\t\t(languageid, fieldname, varname, text, product, username, dateline, version)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t" . implode(",\n", $phrase_sql));
                $phrase_sql = array();
                $phrase_sql_len = 0;
            }
            if ($help_sql_len > 102400) {
                // insert max of 100k of phrases at a time
                /*insert query*/
                $vbulletin->db->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "adminhelp\n\t\t\t\t\t\t(script, action, optionname, displayorder, volatile, product)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t" . implode(",\n\t", $help_sql));
                $help_sql = array();
                $help_sql_len = 0;
            }
        }
        if ($help_sql) {
            /*insert query*/
            $vbulletin->db->query_write("\n\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "adminhelp\n\t\t\t\t\t(script, action, optionname, displayorder, volatile, product)\n\t\t\t\tVALUES\n\t\t\t\t\t" . implode(",\n\t", $help_sql));
        }
        if ($phrase_sql) {
            /*insert query*/
            $vbulletin->db->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "phrase\n\t\t\t\t\t\t(languageid, fieldname, varname, text, product, username, dateline, version)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t" . implode(",\n", $phrase_sql));
        }
    }
    // stop the 'dots' counter feedback
    print_dots_stop();
    require_once DIR . '/includes/adminfunctions_language.php';
    build_language();
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:91,代码来源:adminfunctions_help.php

示例2: print_stop_message

            print_stop_message('invalid_file_specified');
        }
    }
    if (!is_array($arr['plugin'][0])) {
        $arr['plugin'] = array($arr['plugin']);
    }
    $maxid = $db->query_first("SELECT MAX(pluginid) AS max FROM " . TABLE_PREFIX . "plugin");
    foreach ($arr['plugin'] as $plugin) {
        unset($plugin['devkey']);
        // make sure we don't try to set this as it's no longer used
        $db->query_write(fetch_query_sql($plugin, 'plugin'));
    }
    // rebuild the $vboptions array
    vBulletinHook::build_datastore($db);
    // stop the 'dots' counter feedback
    print_dots_stop();
    print_cp_redirect("plugin.php?" . $vbulletin->session->vars['sessionurl'], 0);
}
// #############################################################################
if ($_POST['do'] == 'download') {
    $vbulletin->input->clean_array_gpc('p', array('filename' => TYPE_STR, 'download' => TYPE_ARRAY_UINT));
    if (empty($vbulletin->GPC['download']) or empty($vbulletin->GPC['filename'])) {
        print_stop_message('please_complete_required_fields');
    }
    require_once DIR . '/includes/class_xml.php';
    $xml = new vB_XML_Builder($vbulletin);
    $xml->add_group('plugins');
    $plugins = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "plugin WHERE pluginid IN (" . implode(', ', $vbulletin->GPC['download']) . ")");
    while ($plugin = $db->fetch_array($plugins)) {
        $params = array('active' => $plugin['active'], 'executionorder' => $plugin['executionorder']);
        if ($plugin['product']) {
开发者ID:Kheros,项目名称:MMOver,代码行数:31,代码来源:plugin.php

示例3: post_install


//.........这里部分代码省略.........
             $cron['active'] = $cron['active'] ? 1 : 0;
             $cron['loglevel'] = $cron['loglevel'] ? 1 : 0;
             $scheduling = $cron['scheduling'];
             $scheduling['weekday'] = intval($scheduling['weekday']);
             $scheduling['day'] = intval($scheduling['day']);
             $scheduling['hour'] = intval($scheduling['hour']);
             $scheduling['minute'] = explode(',', preg_replace('#[^0-9,-]#i', '', $scheduling['minute']));
             if (count($scheduling['minute']) == 0) {
                 $scheduling['minute'] = array(0);
             } else {
                 $scheduling['minute'] = array_map('intval', $scheduling['minute']);
             }
             /*insert query*/
             $this->db->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "cron\n\t\t\t\t\t\t(weekday, day, hour, minute, filename, loglevel, active, varname, volatile, product)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$scheduling['weekday']},\n\t\t\t\t\t\t{$scheduling['day']},\n\t\t\t\t\t\t{$scheduling['hour']},\n\t\t\t\t\t\t'" . $this->db->escape_string(serialize($scheduling['minute'])) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($cron['filename']) . "',\n\t\t\t\t\t\t{$cron['loglevel']},\n\t\t\t\t\t\t{$cron['active']},\n\t\t\t\t\t\t'" . $this->db->escape_string($cron['varname']) . "',\n\t\t\t\t\t\t1,\n\t\t\t\t\t\t'" . $this->db->escape_string($this->productinfo['productid']) . "')\n\t\t\t\t");
             $cronid = $this->db->insert_id();
             // replace either inserts, or deletes+inserts
             if ($cronid) {
                 build_cron_item($cronid);
             }
             $rebuild['cron'] = true;
         }
     }
     // ############## import faq
     if (!empty($this->productobj['faqentries']['faq']) and is_array($this->productobj['faqentries']['faq'])) {
         $faq_entries =& $this->productobj['faqentries']['faq'];
         if (!isset($faq_entries[0])) {
             $faq_entries = array($faq_entries);
         }
         $sql = array();
         foreach ($faq_entries as $faq) {
             $sql[] = "\n\t\t\t\t\t('" . $this->db->escape_string($faq['faqname']) . "',\n\t\t\t\t\t'" . $this->db->escape_string($faq['faqparent']) . "',\n\t\t\t\t\t" . intval($faq['displayorder']) . ",\n\t\t\t\t\t1,\n\t\t\t\t\t'" . $this->db->escape_string($this->productinfo['productid']) . "')\n\t\t\t\t";
         }
         if ($sql) {
             /*insert query*/
             $this->db->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "faq\n\t\t\t\t\t\t(faqname, faqparent, displayorder, volatile, product)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t" . implode(',', $sql) . "\n\t\t\t\t");
         }
     }
     $this->productinfo['process'] = VB_AREA;
     $this->productinfo['username'] = 'Product-' . VB_AREA;
     import_navigation($this->productobj, $this->productinfo);
     $products = fetch_product_list(true);
     // Check if the plugin system is disabled. If it is, enable it if this product isn't installed.
     if (!$this->registry->options['enablehooks'] and !$products[$this->productinfo['productid']]) {
         $this->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "setting\n\t\t\t\tSET value = '1'\n\t\t\t\tWHERE varname = 'enablehooks'\n\t\t\t");
         $rebuild['options'] = true;
     }
     // Now rebuild everything we need...
     if ($rebuild['plugins']) {
         vBulletinHook::build_datastore($this->db);
         if ($this->active) {
             $plugin_data = $this->db->query_read("\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM " . TABLE_PREFIX . "datastore\n\t\t\t\t\tWHERE title IN ('pluginlist', 'pluginlistadmin')\n\t\t\t\t");
             while ($plugin_info = $this->db->fetch_array($plugin_data)) {
                 if ($plugin_info['title'] == 'pluginlist') {
                     $this->registry->pluginlist = unserialize($plugin_info['data']);
                 } else {
                     if ($plugin_info['title'] == 'pluginlistadmin') {
                         $this->registry->pluginlistadmin = unserialize($plugin_info['data']);
                     }
                 }
             }
             // enable any hooks -- this is mainly necessary for importing templates (template_safe_functions hook)
             if (!defined('DISABLE_HOOKS') and VB_AREA != 'Upgrade') {
                 if (!empty($this->registry->pluginlistadmin) and is_array($this->registry->pluginlistadmin)) {
                     $this->registry->pluginlist = array_merge($this->registry->pluginlist, $this->registry->pluginlistadmin);
                     unset($this->registry->pluginlistadmin);
                 }
                 vBulletinHook::set_pluginlist($this->registry->pluginlist, $vbulletin->options['hookerrors']);
             }
         }
     }
     if ($rebuild['templates']) {
         if ($error = build_all_styles(0, 0, '', false, 'standard')) {
             return $error;
         }
         if ($error = build_all_styles(0, 0, '', false, 'mobile')) {
             return $error;
         }
     }
     if ($rebuild['phrases']) {
         require_once DIR . '/includes/adminfunctions_language.php';
         build_language();
     }
     if ($rebuild['options']) {
         build_options();
     }
     if ($rebuild['cron']) {
         require_once DIR . '/includes/functions_cron.php';
         build_cron_next_run();
     }
     build_product_datastore();
     build_activitystream_datastore();
     // build bitfields to remove/add this products bitfields
     vB_Bitfield_Builder::save($this->db);
     // reload block types
     $blockmanager = vB_BlockManager::create($this->registry);
     $blockmanager->reloadBlockTypes();
     print_dots_stop();
     $this->productinfo['need_merge'] = ($rebuild['templates'] and $installed_version);
     return $this->productinfo;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:101,代码来源:class_upgrade_product.php

示例4: 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
* @param  int|null Starting template group index for this run of importing templates (0 based).
*		Null means all templates (single run)
* @paream int|null
*
* @return	array	Array of information about the imported style
*/
function xml_import_style(
	$xml = false,
	$styleid = -1,
	$parentid = -1,
	$title = '',
	$anyversion = false,
	$displayorder = 1,
	$userselect = true,
	$startat = null,
	$perpage = null
)
{
	// $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');

	//where is this used?  I hate having this random global value in the middle of this function
	$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(!$parsed_xml = $xmlobj->parse())
	{
		print_dots_stop();
		print_stop_message('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line());
	}

	$version = $parsed_xml['vbversion'];
	$master = ($parsed_xml['type'] == 'master' ? 1 : 0);
	$title = (empty($title) ? $parsed_xml['name'] : $title);
	$product = (empty($parsed_xml['product']) ? 'vbulletin' : $parsed_xml['product']);


	$one_pass = (is_null($startat) AND is_null($perpage));
	if (!$one_pass AND (!is_numeric($startat) OR !is_numeric($perpage) OR $perpage <= 0 OR $startat < 0))
	{
			print_dots_stop();
			print_stop_message('');
	}

	if ($one_pass OR ($startat == 0))
	{
		// version check
		$full_product_info = fetch_product_list(true);
		$product_info = $full_product_info["$product"];

		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);
		}

		//Initialize the style -- either init the master, create a new style, or verify the style to overwrite.
		if ($master)
		{
			$import_data = @unserialize(fetch_adminutil_text('master_style_import'));
			if (!empty($import_data) AND (TIMENOW - $import_data['last_import']) <= 30)
			{
				print_dots_stop();
				print_stop_message('must_wait_x_seconds_master_style_import', vb_number_format($import_data['last_import'] + 30 - TIMENOW));
			}

			// 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 = ''") . ")"
			);

//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:adminfunctions_template.php

示例5: 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

示例6: xml_import_language

/**
* Imports a language from a language XML file
*
* @param	string	XML language string
* @param	integer	Language to overwrite
* @param	string	Override title for imported language
* @param	boolean	Allow import of language from mismatched vBulletin version
* @param	boolean	Allow user-select of imported language
* @param	boolean	Echo output..
* @param	boolean	Read charset from XML header
*/
function xml_import_language($xml = false, $languageid = -1, $title = '', $anyversion = false, $userselect = true, $output = true, $readcharset = false)
{
    global $vbulletin, $vbphrase;
    print_dots_start('<b>' . $vbphrase['importing_language'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
    require_once DIR . '/includes/class_xml.php';
    require_once DIR . '/includes/functions_misc.php';
    $xmlobj = new vB_XML_Parser($xml, $GLOBALS['path'], $readcharset);
    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-language.xml', $GLOBALS['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['phrasetype']) {
        print_dots_stop();
        print_stop_message('invalid_file_specified');
    }
    $title = empty($title) ? $arr['name'] : $title;
    $version = $arr['vbversion'];
    $master = $arr['type'] == 'master' ? 1 : 0;
    $just_phrases = $arr['type'] == 'phrases' ? 1 : 0;
    if (!empty($arr['settings'])) {
        $langinfo = $arr['settings'];
    }
    $langinfo['product'] = empty($arr['product']) ? 'vbulletin' : $arr['product'];
    // look for skipped groups
    $skipped_groups = array();
    if (!empty($arr['skippedgroups'])) {
        $skippedgroups =& $arr['skippedgroups']['skippedgroup'];
        if (!is_array($skippedgroups[0])) {
            $skippedgroups = array($skippedgroups);
        }
        foreach ($skippedgroups as $skipped) {
            if (is_array($skipped)) {
                $skipped_groups[] = $vbulletin->db->escape_string($skipped['value']);
            } else {
                $skipped_groups[] = $vbulletin->db->escape_string($skipped);
            }
        }
    }
    if ($skipped_groups) {
        $sql_skipped = "AND " . TABLE_PREFIX . "phrase.fieldname NOT IN ('" . implode("', '", $skipped_groups) . "')";
    } else {
        $sql_skipped = '';
    }
    foreach ($langinfo as $key => $val) {
        $langinfo["{$key}"] = $vbulletin->db->escape_string(trim($val));
    }
    $langinfo['options'] = intval($langinfo['options']);
    if ($version != $vbulletin->options['templateversion'] and !$anyversion and !$master) {
        print_dots_stop();
        print_stop_message('upload_file_created_with_different_version', $vbulletin->options['templateversion'], $version);
    }
    //set up the phrase array
    $arr = $arr['phrasetype'];
    if (!is_array($arr[0])) {
        $arr = array($arr);
    }
    //spin through the phrases to check validity.  We want to do this *before* we prep for import
    //so that if we abort do to an error, we haven't made any changes first
    foreach (array_keys($arr) as $key) {
        $phraseTypes =& $arr["{$key}"];
        foreach ($phraseTypes['phrase'] as $phrase) {
            if (!validate_string_for_interpolation($phrase['value'])) {
                print_dots_stop();
                print_stop_message('phrase_text_not_safe', $phrase['name']);
            }
        }
    }
    // prepare for import
    if ($master) {
        // lets stop it from dieing cause someone borked a previous update
        $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "phrase WHERE languageid = -10");
        // master style
        if ($output and VB_AREA != 'Install' and VB_AREA != 'Upgrade') {
            echo "<h3>{$vbphrase['master_language']}</h3>\n<p>{$vbphrase['please_wait']}</p>";
            vbflush();
        }
        $vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "phrase SET\n\t\t\t\tlanguageid = -10\n\t\t\tWHERE languageid = -1\n\t\t\t\tAND (product = '" . $vbulletin->db->escape_string($langinfo['product']) . "'" . iif($langinfo['product'] == 'vbulletin', " OR product = ''") . ")\n\t\t\t\t{$sql_skipped}\n\t\t");
        $languageid = -1;
    } else {
        if ($languageid == 0) {
//.........这里部分代码省略.........
开发者ID:0hyeah,项目名称:yurivn,代码行数:101,代码来源:adminfunctions_language.php

示例7: xml_restore_settings

/**
* Restores a settings backup from an XML file
*
* Call as follows:
* $path = './path/to/install/vbulletin-settings.xml';
* xml_import_settings($xml);
*
* @param	mixed	Either XML string or boolean false to use $path global variable
* @param bool	Ignore blacklisted settings
*/
function xml_restore_settings($xml = false, $blacklist = true)
{
    global $vbulletin, $vbphrase;
    $newsettings = array();
    print_dots_start('<b>' . $vbphrase['importing_settings'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
    require_once DIR . '/includes/class_xml.php';
    $xmlobj = new vB_XML_Parser($xml, $GLOBALS['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-settings.xml', $GLOBALS['path']);
        }
    }
    if (!($newsettings = $xmlobj->parse())) {
        print_dots_stop();
        print_stop_message('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line());
    }
    if (!$newsettings['setting']) {
        print_dots_stop();
        print_stop_message('invalid_file_specified');
    }
    $product = empty($newsettings['product']) ? 'vbulletin' : $newsettings['product'];
    foreach ($newsettings['setting'] as $setting) {
        // Loop to update all the settings
        $vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "setting\n\t\t\tSET value='" . $vbulletin->db->escape_string($setting['value']) . "'\n\t\t\tWHERE varname ='" . $vbulletin->db->escape_string($setting['varname']) . "'\n\t\t\t\tAND product ='" . $vbulletin->db->escape_string($product) . "'\n\t\t\t\t" . ($blacklist ? "AND blacklist = 0" : "") . "\n\t\t");
    }
    unset($newsettings);
    // rebuild the $vbulletin->options array
    build_options();
    // stop the 'dots' counter feedback
    print_dots_stop();
}
开发者ID:holandacz,项目名称:nb4,代码行数:45,代码来源:adminfunctions_options.php

示例8: xml_import_grid

/**
* Reads XML grids file and imports data from it into the database
*
* @param	string	XML data
* @param	boolean	Allow overwriting of existing grids with same name
*/
function xml_import_grid($xml = false, $allowoverwrite = false)
{
	// $GLOBALS['path'] needs to be passed into this function or reference $vbulletin->GPC['path']

	global $vbulletin, $vbphrase;

	print_dots_start('<b>' . $vbphrase['importing_grid'] . "</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-grid.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['grid'])
	{
		print_dots_stop();
		print_stop_message('invalid_file_specified');
	}

	$grids = array();
	$gridq = $vbulletin->db->query_read("
		SELECT gridid
		FROM " . TABLE_PREFIX . "cms_grid
	");
	while ($grid = $vbulletin->db->fetch_array($gridq))
	{
		$grids[] = $grid['gridid'];
	}

	if (!is_array($arr['grid'][0]))
	{
		$arr['grid'] = array($arr['grid']);
	}

	require_once(DIR . '/includes/adminfunctions_template.php');

	$newgrids = array();
	foreach($arr['grid'] AS $grid)
	{
		$vbulletin->db->query_write("
			" . ($allowoverwrite ? "REPLACE" : "INSERT IGNORE") . " INTO " . TABLE_PREFIX . "cms_grid
				(title, auxheader, auxfooter, addcolumn, addcolumnsnap, addcolumnsize, gridcolumns, gridhtml)
			VALUES
				(
					'" . $vbulletin->db->escape_string($grid['name']) . "',
					" . intval($grid['auxheader']) . ",
					" . intval($grid['auxfooter']) . ",
					" . intval($grid['addcolumn']) . ",
					" . intval($grid['addcolumnsnap']) . ",
					" . intval($grid['addcolumnsize']) . ",
					" . intval($grid['gridcolumns']) . ",
					'" . $vbulletin->db->escape_string($grid['value']) . "'
				)
		");

		if ($gridid = $vbulletin->db->insert_id())
		{
			$title = "vbcms_grid_$gridid";
			$vbulletin->db->query_write("
				REPLACE INTO " . TABLE_PREFIX . "template
					(styleid, title, template, template_un, dateline, username, product, version)
				VALUES
					(
						0,
						'" . $vbulletin->db->escape_string($title) . "',
						'" . $vbulletin->db->escape_string(compile_template($grid["value"])) . "',
						'" . $vbulletin->db->escape_string($grid["value"]) . "',
						" . TIMENOW . ",
						'" . $vbulletin->vbulletin->userinfo['username'] . "',
						'vbcms',
						'" . $vbulletin->db->escape_string($vbulletin->options['templateversion']) . "'
					)
			");
		}
	}

	$newgrids = array();
	$gridq = $vbulletin->db->query_read("
		SELECT gridid
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:adminfunctions_cms.php

示例9: install_product

/**
* Installs a product from the xml text
*
* This function depends on the vb class loader, which requires that the
* framework init is called.
*
* @return bool True if the product requires a template merge, false otherwise
*/
function install_product($xml, $allow_overwrite)
{
	global $vbphrase;
	global $vbulletin;
	global $db;

	require_once(DIR . '/includes/class_bitfield_builder.php');
	require_once(DIR . '/includes/class_xml.php');
	require_once(DIR . '/includes/class_block.php');

	//share some code with the main xml style import
	require_once(DIR . '/includes/adminfunctions_template.php');

	print_dots_start('<b>' . $vbphrase['importing_product'] . "</b>, $vbphrase[please_wait]", ':', 'dspan');

	$xmlobj = new vB_XML_Parser($xml);
	if ($xmlobj->error_no == 1)
	{
		print_dots_stop();
		throw new vB_Exception_AdminStopMessage('no_xml_and_no_path');
	}

	if(!$arr = $xmlobj->parse())
	{
		print_dots_stop();
		throw new vB_Exception_AdminStopMessage(
			array('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line()));
	}

	// ############## general product information
	$info = array(
		'productid'       => substr(preg_replace('#[^a-z0-9_]#', '', strtolower($arr['productid'])), 0, 25),
		'title'           => $arr['title'],
		'description'     => $arr['description'],
		'version'         => $arr['version'],
		'active'          => $arr['active'],
		'url'             => $arr['url'],
		'versioncheckurl' => $arr['versioncheckurl']
	);

	if (!$info['productid'])
	{
		print_dots_stop();
		if (!empty($arr['plugin']))
		{
			throw new vB_Exception_AdminStopMessage('this_file_appears_to_be_a_plugin');
		}
		else
		{
			throw new vB_Exception_AdminStopMessage('invalid_file_specified');
		}
	}

	if (strtolower($info['productid']) == 'vbulletin')
	{
		print_dots_stop();
		throw new vB_Exception_AdminStopMessage(array('product_x_installed_no_overwrite', 'vBulletin'));
	}

	// check for bitfield conflicts on install
	$bitfields = vB_Bitfield_Builder::return_data();
	if (!$bitfields)
	{
		$bfobj =& vB_Bitfield_Builder::init();
		if ($bfobj->errors)
		{
			print_dots_stop();
			throw new vB_Exception_AdminStopMessage(array(
				'bitfield_conflicts_x',
				'<li>' . implode('</li><li>', $bfobj->errors) . '</li>'
			));
		}
	}

	// get system version info
	$system_versions = array(
		'php' => PHP_VERSION,
		'vbulletin' => $vbulletin->options['templateversion'],
		'products' => fetch_product_list(true)
	);
	$mysql_version = $db->query_first("SELECT VERSION() AS version");
	$system_versions['mysql'] = $mysql_version['version'];

	// ############## import dependencies
	if (is_array($arr['dependencies']['dependency']))
	{
		$dependencies =& $arr['dependencies']['dependency'];
		if (!isset($dependencies[0]))
		{
			$dependencies = array($dependencies);
		}

//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:adminfunctions_plugin.php

示例10: xml_restore_settings

/**
* Restores a settings backup from an XML file
*
* Call as follows:
* $path = './path/to/install/vbulletin-settings.xml';
* xml_import_settings($xml);
*
* @param	mixed	Either XML string or boolean false to use $path global variable
* @param bool	Ignore blacklisted settings
*/
function xml_restore_settings($xml = false, $blacklist = true)
{
    $newsettings = array();
    $vbphrase = vB_Api::instanceInternal('phrase')->fetch(array('please_wait', 'importing_settings'));
    print_dots_start('<b>' . $vbphrase['importing_settings'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
    require_once DIR . '/includes/class_xml.php';
    $xmlobj = new vB_XML_Parser($xml, $GLOBALS['path']);
    if ($xmlobj->error_no() == 1) {
        print_dots_stop();
        print_stop_message2('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-settings.xml', $GLOBALS['path']);
        }
    }
    if (!($newsettings = $xmlobj->parse())) {
        print_dots_stop();
        print_stop_message('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line());
    }
    if (!$newsettings['setting']) {
        print_dots_stop();
        print_stop_message2('invalid_file_specified');
    }
    $product = empty($newsettings['product']) ? 'vbulletin' : $newsettings['product'];
    foreach ($newsettings['setting'] as $setting) {
        // Loop to update all the settings
        $conditions = array(array('field' => 'varname', 'value' => $setting['varname'], 'operator' => vB_dB_Query::OPERATOR_EQ), array('field' => 'product', 'value' => $product, 'operator' => vB_dB_Query::OPERATOR_EQ));
        if ($blacklist) {
            $conditions[] = array('field' => 'blacklist', 'value' => 0, 'operator' => vB_dB_Query::OPERATOR_EQ);
        }
        vB::getDbAssertor()->assertQuery('setting', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'value' => $setting['value'], vB_dB_Query::CONDITIONS_KEY => $conditions));
    }
    unset($newsettings);
    // rebuild the options array
    vB::getDatastore()->build_options();
    // stop the 'dots' counter feedback
    print_dots_stop();
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:49,代码来源:adminfunctions_options.php

示例11: install_product

/**
* Installs a product from the xml text
*
* This function depends on the vb class loader, which requires that the
* framework init is called.
*
* @return bool True if the product requires a template merge, false otherwise
*/
function install_product($xml, $allow_overwrite = false, $verbose = true)
{
    global $vbphrase;
    global $vbulletin;
    $assertor = vB::getDbAssertor();
    require_once DIR . '/includes/class_bitfield_builder.php';
    require_once DIR . '/includes/class_xml.php';
    //share some code with the main xml style import
    require_once DIR . '/includes/adminfunctions_template.php';
    if ($verbose) {
        print_dots_start('<b>' . $vbphrase['importing_product'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
    }
    $xmlobj = new vB_XML_Parser($xml);
    if ($xmlobj->error_no() == 1) {
        if ($verbose) {
            print_dots_stop();
        }
        throw new vB_Exception_AdminStopMessage('no_xml_and_no_path');
    }
    if (!($arr = $xmlobj->parse())) {
        if ($verbose) {
            print_dots_stop();
        }
        throw new vB_Exception_AdminStopMessage(array('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line()));
    }
    // ############## general product information
    $info = array('productid' => substr(preg_replace('#[^a-z0-9_]#', '', strtolower($arr['productid'])), 0, 25), 'title' => $arr['title'], 'description' => $arr['description'], 'version' => $arr['version'], 'active' => $arr['active'], 'url' => $arr['url'], 'versioncheckurl' => $arr['versioncheckurl']);
    if (!$info['productid']) {
        if ($verbose) {
            print_dots_stop();
        }
        throw new vB_Exception_AdminStopMessage('invalid_file_specified');
    }
    if (strtolower($info['productid']) == 'vbulletin') {
        if ($verbose) {
            print_dots_stop();
        }
        throw new vB_Exception_AdminStopMessage(array('product_x_installed_no_overwrite', 'vBulletin'));
    }
    // check for bitfield conflicts on install
    $bitfields = vB_Bitfield_Builder::return_data();
    if (!$bitfields) {
        $bfobj =& vB_Bitfield_Builder::init();
        if ($bfobj->errors) {
            if ($verbose) {
                print_dots_stop();
            }
            throw new vB_Exception_AdminStopMessage(array('bitfield_conflicts_x', '<li>' . implode('</li><li>', $bfobj->errors) . '</li>'));
        }
    }
    // get system version info
    $system_versions = array('php' => PHP_VERSION, 'vbulletin' => $vbulletin->options['templateversion'], 'products' => fetch_product_list(true));
    $mysql_version = $assertor->getRow('mysqlVersion');
    $system_versions['mysql'] = $mysql_version['version'];
    // ############## import dependencies
    if (isset($arr['dependencies']['dependency']) and is_array($arr['dependencies']['dependency'])) {
        $dependencies =& $arr['dependencies']['dependency'];
        if (!isset($dependencies[0])) {
            $dependencies = array($dependencies);
        }
        $dependency_errors = array();
        $ignore_dependency_errors = array();
        // let's check the dependencies
        foreach ($dependencies as $dependency) {
            // if we get an error, we haven't met this dependency
            // if we go through without a problem, we have automatically met
            // all dependencies for this "class" (mysql, php, vb, a specific product, etc)
            $this_dependency_met = true;
            // build a phrase for the version compats -- will look like (minver / maxver)
            if ($dependency['minversion']) {
                $compatible_phrase = construct_phrase($vbphrase['compatible_starting_with_x'], htmlspecialchars_uni($dependency['minversion']));
            } else {
                $compatible_phrase = '';
            }
            if ($dependency['maxversion']) {
                $incompatible_phrase = construct_phrase($vbphrase['incompatible_with_x_and_greater'], htmlspecialchars_uni($dependency['maxversion']));
            } else {
                $incompatible_phrase = '';
            }
            if ($compatible_phrase or $incompatible_phrase) {
                $required_version_info = "({$compatible_phrase}";
                if ($compatible_phrase and $incompatible_phrase) {
                    $required_version_info .= ' / ';
                }
                $required_version_info .= "{$incompatible_phrase})";
            }
            // grab the appropriate installed version string
            if ($dependency['dependencytype'] == 'product') {
                // group dependencies into types -- individual products get their own group
                $dependency_type_key = "product-{$dependency['parentproductid']}";
                // undocumented feature -- you can put a producttitle attribute in a dependency so the id isn't displayed
                $parent_product_title = !empty($dependency['producttitle']) ? $dependency['producttitle'] : $dependency['parentproductid'];
//.........这里部分代码省略.........
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:101,代码来源:adminfunctions_product.php

示例12: 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
* @param	int|null Starting template group index for this run of importing templates (0 based). Null means all templates (single run)
* @param	int|null
* @param	int 0 = normal import, 1 = style generator
* @param	string Import Filename
*
* @return	array	Array of information about the imported style
*/
function xml_import_style($xml = false, $styleid = -1, $parentid = -1, $title = '', $anyversion = false, $displayorder = 1, $userselect = true, $startat = null, $perpage = null, $importtype = 0, $filename = 'vbulletin-style.xml')
{
    // $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';
    //where is this used?  I hate having this random global value in the middle of this function
    $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', $filename, $vbulletin->GPC['path']);
        }
    }
    if (!($parsed_xml = $xmlobj->parse())) {
        print_dots_stop();
        print_stop_message('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line());
    }
    if (!$styleid) {
        if ($parentid == -1 or $parentid == -2) {
            $styleid = $parentid;
        } else {
            $style = $vbulletin->db->query_first("\n\t\t\t\tSELECT IF(type = 'standard', -1, -2) AS mastertype\n\t\t\t\tFROM " . TABLE_PREFIX . "style\n\t\t\t\tWHERE styleid = {$parentid}\n\t\t\t");
            $styleid = $style['mastertype'];
        }
    }
    $version = $parsed_xml['vbversion'];
    $master = $parsed_xml['type'] == 'master' ? true : false;
    $mobilemaster = $parsed_xml['type'] == 'mobilemaster' ? true : false;
    $title = empty($title) ? $parsed_xml['name'] : $title;
    $product = empty($parsed_xml['product']) ? 'vbulletin' : $parsed_xml['product'];
    $one_pass = (is_null($startat) and is_null($perpage));
    if (!$one_pass and (!is_numeric($startat) or !is_numeric($perpage) or $perpage <= 0 or $startat < 0)) {
        print_dots_stop();
        print_stop_message('');
    }
    if ($one_pass or $startat == 0) {
        // version check
        $full_product_info = fetch_product_list(true);
        $product_info = $full_product_info["{$product}"];
        if ($version != $product_info['version'] and !$anyversion and !$master and !$mobilemaster) {
            print_dots_stop();
            print_stop_message('upload_file_created_with_different_version', $product_info['version'], $version);
        }
        //Initialize the style -- either init the master, create a new style, or verify the style to overwrite.
        if ($master or $mobilemaster) {
            $styleid = $master ? -1 : -2;
            $specialstyleid = $master ? -10 : -20;
            $import_data = @unserialize(fetch_adminutil_text("master_style_import_{$product}_{$specialstyleid}"));
            if (!empty($import_data) and TIMENOW - $import_data['last_import'] <= 30) {
                print_dots_stop();
                if ($master) {
                    print_stop_message('must_wait_x_seconds_master_style_import', vb_number_format($import_data['last_import'] + 30 - TIMENOW));
                } else {
                    print_stop_message('must_wait_x_seconds_mobile_master_style_import', vb_number_format($import_data['last_import'] + 30 - TIMENOW));
                }
            }
            $stylename = $master ? $vbphrase['master_style'] : $vbphrase['mobile_master_style'];
            // overwrite master style
            if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') {
                echo "<h3>{$stylename}</h3>\n<p>{$vbphrase['please_wait']}</p>";
                vbflush();
            }
            $vbulletin->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "template\n\t\t\t\tWHERE styleid = {$specialstyleid} AND (product = '" . $vbulletin->db->escape_string($product) . "'" . ($product == 'vbulletin' ? " OR product = ''" : "") . ")");
            $vbulletin->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "template\n\t\t\t\tSET styleid = {$specialstyleid} WHERE styleid = {$styleid} AND (product = '" . $vbulletin->db->escape_string($product) . "'" . ($product == 'vbulletin' ? " OR product = ''" : "") . ")");
        } else {
            if ($styleid == -1 or $styleid == -2) {
                $type = $styleid == -1 ? 'standard' : 'mobile';
                // creating a new style
                $test = $vbulletin->db->query_first("\n\t\t\t\t\tSELECT styleid FROM " . TABLE_PREFIX . "style\n\t\t\t\t\tWHERE\n\t\t\t\t\t\ttitle = '" . $vbulletin->db->escape_string($title) . "'\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\ttype = '{$type}'\n\t\t\t\t");
                if ($test) {
                    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\t\tINSERT INTO " . TABLE_PREFIX . "style\n\t\t\t\t\t\t(title, parentid, displayorder, userselect, type)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . $vbulletin->db->escape_string($title) . "', {$parentid}, {$displayorder}, " . ($userselect ? 1 : 0) . ", '{$type}')\n\t\t\t\t\t");
                    $styleid = $vbulletin->db->insert_id($styleresult);
                }
//.........这里部分代码省略.........
开发者ID:0hyeah,项目名称:yurivn,代码行数:101,代码来源:adminfunctions_template.php

示例13: post_install


//.........这里部分代码省略.........
         $sql = array();
         foreach ($faq_entries as $faq) {
             $sql[] = "\n\t\t\t\t\t('" . $this->db->escape_string($faq['faqname']) . "',\n\t\t\t\t\t'" . $this->db->escape_string($faq['faqparent']) . "',\n\t\t\t\t\t" . intval($faq['displayorder']) . ",\n\t\t\t\t\t1,\n\t\t\t\t\t'" . $this->db->escape_string($this->productinfo['productid']) . "')\n\t\t\t\t";
         }
         if ($sql) {
             /*insert query*/
             $this->db->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "faq\n\t\t\t\t\t\t(faqname, faqparent, displayorder, volatile, product)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t" . implode(',', $sql) . "\n\t\t\t\t");
         }
     }
     // ############## import widgets
     /* Copied from adminfinctions_product.php
     	At some point we need to get rid of this product install duplication */
     if (isset($this->productobj['widgets']['widget']) and is_array($this->productobj['widgets']['widget'])) {
         $widgets =& $this->productobj['widgets']['widget'];
         if (!isset($widgets[0])) {
             $widgets = array($widgets);
         }
         $assertor = vB::getDbAssertor();
         foreach ($widgets as $widget) {
             $existing = $assertor->getRow('widget', array('guid' => $widget['guid'], 'product' => $info['productid']));
             if ($existing['widgetid']) {
                 $data = $widget + $existing;
                 unset($data['definitions']);
                 $data['isthirdparty'] = 1;
                 $data['product'] = $info['productid'];
                 $result = $assertor->update('widget', $data, array('widgetid' => $existing['widgetid']));
                 $wdfs_old = $assertor->getRows('widgetdefinition', array('widgetid' => $existing['widgetid']));
                 $assertor->delete('widgetdefinition', array('widgetid' => $existing['widgetid']));
                 $index_old = array();
                 foreach ($wdfs_old as $key => $definition) {
                     $index_old[$key] = $definition['name'];
                 }
                 $wdfs_new =& $widget['definitions']['definition'];
                 if (!isset($wdfs_new[0])) {
                     $wdfs_new = array($wdfs_new);
                 }
                 foreach ($wdfs_new as &$definition) {
                     if ($key_old = array_search($definition['name'], $index_old)) {
                         $definition = $definition + $wdfs_old[$key_old];
                     }
                     $data = $definition;
                     $data['product'] = $info['productid'];
                     $data['widgetid'] = $existing['widgetid'];
                     $assertor->insert('widgetdefinition', $data);
                 }
             } else {
                 $data = $widget;
                 $data['isthirdparty'] = 1;
                 $data['product'] = $info['productid'];
                 unset($data['definitions']);
                 $result = $assertor->insert('widget', $data);
                 $widgetid = is_array($result) ? array_pop($result) : $result;
                 if ($widgetid and is_array($widget['definitions']['definition'])) {
                     $definitions =& $widget['definitions']['definition'];
                     if (!isset($definitions[0])) {
                         $definitions = array($definitions);
                     }
                     foreach ($definitions as $definition) {
                         $data = $definition;
                         $data['widgetid'] = $widgetid;
                         $data['product'] = $info['productid'];
                         $assertor->insert('widgetdefinition', $data);
                     }
                 }
             }
         }
     }
     $products = fetch_product_list(true);
     // Check if the plugin system is disabled. If it is, enable it if this product isn't installed.
     if (!$this->registry->options['enablehooks'] and !$products[$this->productinfo['productid']]) {
         $this->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "setting\n\t\t\t\tSET value = '1'\n\t\t\t\tWHERE varname = 'enablehooks'\n\t\t\t");
         $rebuild['options'] = true;
     }
     // Now rebuild everything we need...
     if ($rebuild['hooks']) {
         vB_Api::instanceInternal("Hook")->buildHookDatastore();
     }
     if ($rebuild['templates']) {
         if ($error = build_all_styles(0, 0, '')) {
             return $error;
         }
     }
     if ($rebuild['phrases']) {
         require_once DIR . '/includes/adminfunctions_language.php';
         build_language();
     }
     if ($rebuild['options']) {
         vB::getDatastore()->build_options();
     }
     if ($rebuild['cron']) {
         require_once DIR . '/includes/functions_cron.php';
         build_cron_next_run();
     }
     build_product_datastore();
     // build bitfields to remove/add this products bitfields
     vB_Bitfield_Builder::save($this->db);
     print_dots_stop();
     $this->productinfo['need_merge'] = ($rebuild['templates'] and $installed_version);
     return $this->productinfo;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:101,代码来源:class_upgrade_product.php

示例14: xml_import_style

/**
* Reads XML style file and imports data from it into the database
*
* @param	string	$xml		XML data
* @param	integer	$styleid	Style ID
* @param	integer	$parentid	Parent style ID
* @param	string	$title		New style title
* @param	boolean	$anyversion	Allow vBulletin version mismatch
* @param	integer	$displayorder	Display order for new style
* @param	boolean	$userselct	Allow user selection of new style
* @param  	int|null	$startat	Starting template group index for this run of importing templates (0 based). Null means all templates (single run)
* @param  	int|null	$perpage	Number of templates to import at a time
* @param	boolean	$scilent		Run silently (do not echo)
* @param	array|boolean	$parsed_xml	Parsed array of XML data. If provided the function will ignore $xml and use the provided, already parsed data.
*
* @return	array	Array of information about the imported style
*/
function xml_import_style($xml = false, $styleid = -1, $parentid = -1, $title = '', $anyversion = false, $displayorder = 1, $userselect = true, $startat = null, $perpage = null, $scilent = false, $parsed_xml = false)
{
    // $GLOBALS['path'] needs to be passed into this function or reference $vbulletin->GPC['path']
    //checking the root node name
    if (!empty($xml)) {
        $r = new XMLReader();
        if ($r->xml($xml)) {
            if ($r->read()) {
                $node_name = $r->name;
                if ($node_name != 'style') {
                    print_stop_message2('file_uploaded_not_in_right_format_error');
                }
            } else {
                //can not read the document
                print_stop_message2('file_uploaded_unreadable');
            }
        } else {
            //can not open the xml
            print_stop_message2('file_uploaded_unreadable');
        }
    }
    global $vbulletin;
    if (!$scilent) {
        $vbphrase = vB_Api::instanceInternal('phrase')->fetch(array('importing_style', 'please_wait', 'creating_a_new_style_called_x'));
        print_dots_start('<b>' . $vbphrase['importing_style'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
    }
    require_once DIR . '/includes/class_xml.php';
    if (empty($parsed_xml)) {
        //where is this used?  I hate having this random global value in the middle of this function
        $xmlobj = new vB_XML_Parser($xml, $vbulletin->GPC['path']);
        if ($xmlobj->error_no() == 1) {
            if ($scilent) {
                throw new vB_Exception_AdminStopMessage('no_xml_and_no_path');
            }
            print_dots_stop();
            print_stop_message2('no_xml_and_no_path');
        } else {
            if ($xmlobj->error_no() == 2) {
                if ($scilent) {
                    throw new vB_Exception_AdminStopMessage(array('please_ensure_x_file_is_located_at_y', 'vbulletin-style.xml', $vbulletin->GPC['path']));
                }
                print_dots_stop();
                print_stop_message2(array('please_ensure_x_file_is_located_at_y', 'vbulletin-style.xml', $vbulletin->GPC['path']));
            }
        }
        if (!($parsed_xml = $xmlobj->parse())) {
            if ($scilent) {
                throw new vB_Exception_AdminStopMessage(array('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line()));
            }
            print_dots_stop();
            print_stop_message2(array('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line()));
        }
    }
    $version = $parsed_xml['vbversion'];
    $master = $parsed_xml['type'] == 'master' ? 1 : 0;
    $title = empty($title) ? $parsed_xml['name'] : $title;
    $product = empty($parsed_xml['product']) ? 'vbulletin' : $parsed_xml['product'];
    $one_pass = (is_null($startat) and is_null($perpage));
    if (!$one_pass and (!is_numeric($startat) or !is_numeric($perpage) or $perpage <= 0 or $startat < 0)) {
        if ($scilent) {
            throw new vB_Exception_AdminStopMessage('');
        }
        print_dots_stop();
        print_stop_message2('');
    }
    $outputtext = '';
    if ($one_pass or $startat == 0) {
        require_once DIR . '/includes/adminfunctions.php';
        // version check
        $full_product_info = fetch_product_list(true);
        $product_info = $full_product_info["{$product}"];
        if ($version != $product_info['version'] and !$anyversion and !$master) {
            if ($scilent) {
                throw new vB_Exception_AdminStopMessage(array('upload_file_created_with_different_version', $product_info['version'], $version));
            }
            print_dots_stop();
            print_stop_message2(array('upload_file_created_with_different_version', $product_info['version'], $version));
        }
        //Initialize the style -- either init the master, create a new style, or verify the style to overwrite.
        if ($master) {
            $import_data = @unserialize(fetch_adminutil_text('master_style_import'));
            if (!empty($import_data) and TIMENOW - $import_data['last_import'] <= 30) {
                if ($scilent) {
//.........这里部分代码省略.........
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:101,代码来源:adminfunctions_template.php


注:本文中的print_dots_stop函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。