Example #1
0
        $JS_STYLETITLES[] = "\"0\" : \"" . $vbphrase['master_style'] . "\"";
        $prepend = '--';
    }
    foreach ($stylecache as $style) {
        $JS_STYLETITLES[] = "\"{$style['styleid']}\" : \"" . addslashes_js($style['title'], '"') . "\"";
        $JS_STYLEPARENTS[] = "\"{$style['styleid']}\" : \"{$style['parentid']}\"";
    }
    $JS_MONTHS = array();
    $i = 0;
    $months = array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december');
    foreach ($months as $month) {
        $JS_MONTHS[] = "\"{$i}\" : \"" . $vbphrase["{$month}"] . "\"";
        $i++;
    }
    foreach (array('click_the_expand_collapse_button', 'this_template_has_been_customized_in_a_parent_style', 'this_template_has_not_been_customized', 'this_template_has_been_customized_in_this_style', 'template_last_edited_js', 'x_templates') as $phrasename) {
        $JS_PHRASES[] = "\"{$phrasename}\" : \"" . fetch_js_safe_string($vbphrase["{$phrasename}"]) . "\"";
    }
    ?>

<script type="text/javascript">
<!--
var SESSIONHASH = "<?php 
    echo $vbulletin->session->vars['sessionhash'];
    ?>
";
var EXPANDSET = "<?php 
    echo $vbulletin->GPC['expandset'];
    ?>
";
var GROUP = "<?php 
    echo $vbulletin->GPC['group'];
Example #2
0
	foreach($months AS $month)
	{
		$JS_MONTHS[] = "\"$i\" : \"" . $vbphrase["$month"] . "\"";
		$i++;
	}

	foreach (array(
		'click_the_expand_collapse_button',
		'this_template_has_been_customized_in_a_parent_style',
		'this_template_has_not_been_customized',
		'this_template_has_been_customized_in_this_style',
		'template_last_edited_js',
		'x_templates'
		) AS $phrasename)
	{
		$JS_PHRASES[] = "\"$phrasename\" : \"" . fetch_js_safe_string($vbphrase["$phrasename"]) . "\"";
	}

?>

<script type="text/javascript">
<!--
var SESSIONHASH = "<?php echo $vbulletin->session->vars['sessionhash']; ?>";
var EXPANDSET = "<?php echo $vbulletin->GPC['expandset']; ?>";
var GROUP = "<?php echo $vbulletin->GPC['group']; ?>";
var SEARCHSTRING = "<?php echo urlencode($vbulletin->GPC['searchstring']); ?>";
var STYLETITLE = { <?php echo implode(', ', $JS_STYLETITLES); ?> };
var STYLEPARENTS = { <?php echo implode(', ', $JS_STYLEPARENTS); ?> };
var MONTH = { <?php echo implode(', ', $JS_MONTHS); ?> };
var vbphrase = {
	<?php echo implode(",\r\n\t", $JS_PHRASES) . "\r\n"; ?>
/**
* Prints a row containing template search javascript controls
*/
function print_template_javascript()
{
    global $stylevar, $vbphrase, $vbulletin;
    print_phrase_ref_popup_javascript();
    echo '<script type="text/javascript" src="../clientscript/vbulletin_templatemgr.js"></script>';
    echo '<script type="text/javascript">
<!--
	var textarea_id = "' . $vbulletin->textarea_id . '";
	var vbphrase = { \'not_found\' : "' . fetch_js_safe_string($vbphrase['not_found']) . '" };
// -->
</script>
';
    print_label_row(iif(is_browser('ie') or is_browser('mozilla', '20040707'), $vbphrase['search_in_template'], $vbphrase['additional_functions']), iif(is_browser('ie') or is_browser('mozilla', '1.7'), '
	<input type="text" class="bginput" name="string" accesskey="t" value="' . htmlspecialchars_uni($vbulletin->GPC['searchstring']) . '" size="20" onChange="n=0;" tabindex="1" />
	<input type="button" class="button" style="font-weight:normal" value=" ' . $vbphrase['find'] . ' " accesskey="f" onClick="findInPage(document.cpform.string.value);" tabindex="1" />
	&nbsp;') . '<input type="button" class="button" style="font-weight:normal" value=" ' . $vbphrase['copy'] . ' " accesskey="c" onclick="HighlightAll();" tabindex="1" />
	&nbsp;
	<input type="button" class="button" style="font-weight:normal" value="' . $vbphrase['view_quickref'] . '" accesskey="v" onclick="js_open_phrase_ref(0, 0);" tabindex="1" />
	');
}
Example #4
0
	protected function print_color_input_row($title, $name, $value)
	{
		$cp = "";

		//only include the colorpicker on the first color element.
		if (self::$need_colorpicker)
		{
			//construct all of the markup/javascript for the color picker.
			global $vbulletin;

			//set from construct_color_picker
			global $colorPickerWidth, $colorPickerType;

			$cp = '<script type="text/javascript" src="' . $vbulletin->options['bburl'] .
				'/clientscript/vbulletin_cpcolorpicker.js?v=' .
				$vbulletin->options['simpleversion'] . '"></script>' . "\n";
			$cp .= construct_color_picker(11);

			$js_phrases[] = array();
			foreach (array(
				'css_value_invalid',
				'color_picker_not_ready',
			) AS $phrasename)
			{
				$js_phrases[] = "vbphrase.$phrasename = \"" . fetch_js_safe_string($vbphrase["$phrasename"]) . "\"";
			}

			$js_phrases = implode(";\r\n\t", $js_phrases) . ";\r\n";

			$cp .= '
					<script type="text/javascript">
					<!--
					var bburl = "' . $vbulletin->options['bburl'] .'";
					var cpstylefolder = "' . $vbulletin->options['cpstylefolder'] .'";
					var colorPickerWidth = ' . intval($colorPickerWidth) . ';
					var colorPickerType = ' . intval($colorPickerType) . ';
					if(vbphrase == undefined) {vbphrase = new Object();}
					' . $js_phrases . '

					vBulletin.events.systemInit.subscribe(function()
					{
						init_color_preview();
					});
					var cleargifurl = "' .$vbulletin->options['cleargifurl'] .'";
					//-->
				</script>';

			self::$need_colorpicker = false;
		}

		$id = 'color_'. self::$count;

		$color_preview = '<div id="preview_' . self::$count .
			'" class="colorpreview" onclick="open_color_picker(' . self::$count . ', event)"></div>';

		$title_attr = ($vbulletin->debug ? " title=\"name=&quot;$name&quot;\"" : '');
		$cell =
			"<div id=\"ctrl_$name\" class=\"color_input_container\">" .
				"<input type=\"text\" name=\"$name\" id=\"$id\" " .
					"value=\"$value\" " .
					"tabindex=\"1\" $title_attr />" .
			"</div>";

		print_label_row(
			$title,
			$cp . $cell . $color_preview,
			'', 'top', $name
		);

		self::$count++;
	}
Example #5
0
        }
    }
    // make array for daysprune menu
    $pruneoptions = array('0' => '- ' . $vbphrase['use_forum_default'] . ' -', '1' => $vbphrase['show_threads_from_last_day'], '2' => construct_phrase($vbphrase['show_threads_from_last_x_days'], 2), '7' => $vbphrase['show_threads_from_last_week'], '10' => construct_phrase($vbphrase['show_threads_from_last_x_days'], 10), '14' => construct_phrase($vbphrase['show_threads_from_last_x_weeks'], 2), '30' => $vbphrase['show_threads_from_last_month'], '45' => construct_phrase($vbphrase['show_threads_from_last_x_days'], 45), '60' => construct_phrase($vbphrase['show_threads_from_last_x_months'], 2), '75' => construct_phrase($vbphrase['show_threads_from_last_x_days'], 75), '100' => construct_phrase($vbphrase['show_threads_from_last_x_days'], 100), '365' => $vbphrase['show_threads_from_last_year'], '-1' => $vbphrase['show_all_threads']);
    if ($pruneoptions["{$user['daysprune']}"] == '') {
        $pruneoptions["{$user['daysprune']}"] = construct_phrase($vbphrase['show_threads_from_last_x_days'], $user['daysprune']);
    }
    ($hook = vBulletinHook::fetch_hook('useradmin_edit_start')) ? eval($hook) : false;
    if ($vbulletin->GPC['userid']) {
        // a little javascript for the options menus
        ?>
		<script type="text/javascript">
		function pick_a_window(url)
		{
			var modcpurl = "<?php 
        echo fetch_js_safe_string($vbulletin->config['Misc']['modcpdir']);
        ?>
";
			if (url != '')
			{
				if (url.substr(0, 3) == '../' && url.substr(3, modcpurl.length) != modcpurl)
				{
					window.open(url);
				}
				else
				{
					window.location = url;
				}
			}
			return false;
		}
/**
* Reads a language or languages and updates the language db table with the denormalized phrase cache
*
* @param	integer	ID of language to be built; if -1, build all
* @param	integer	Not sure actually... any ideas?
* @param	boolean.  Wether to reset the static vars the function uses to cache items for recursing
* 			when we we build the master language.  Otherwise if we attempt to call this function
* 			twice in the same pageload we don't actually manage to update any changes after the first
* 			call.
* 			The better approach would be to use an internal function and a master function t
* 			hat generates the cached values once and passes them in.
* 			However that means unwinding this function which works but is... odd.
*/
function build_language($languageid = -1, $phrasearray = 0, $reset_static = true)
{
    static $masterlang = null, $jsphrases = null;
    if ($reset_static) {
        $masterlang = null;
        $jsphrases = null;
    }
    // load js safe phrases
    if ($jsphrases === null) {
        require_once DIR . '/includes/class_xml.php';
        $xmlobj = new vB_XML_Parser(false, DIR . '/includes/xml/js_safe_phrases.xml');
        $safephrases = $xmlobj->parse();
        $jsphrases = array();
        if (is_array($safephrases['phrase'])) {
            foreach ($safephrases['phrase'] as $varname) {
                $jsphrases["{$varname}"] = true;
            }
        }
        unset($safephrases, $xmlobj);
    }
    // update all languages if this is the master language
    if ($languageid == -1) {
        $languages = vB::getDatastore()->getValue('languagecache');
        if (empty($languages)) {
            // during install, the datastore is empty
            $languages = vB::getDbAssertor()->assertQuery('language', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_Db_Query::COLUMNS_KEY => array('languageid')));
        }
        foreach ($languages as $language) {
            build_language($language['languageid'], 0, false);
        }
        return;
    }
    // get phrase types for language update
    $gettypes = array();
    $getphrasetypes = vB::getDbAssertor()->getRows('vBForum:fetchphrasetypes', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED));
    foreach ($getphrasetypes as $getphrasetype) {
        $gettypes[] = $getphrasetype['fieldname'];
    }
    unset($getphrasetype);
    //This can be called early in the install process, before phrases have been inserted
    if (empty($gettypes)) {
        return true;
    }
    if (empty($masterlang)) {
        $masterlang = array();
        $phrases = vB::getDbAssertor()->assertQuery('vBForum:phrase', array('languageid' => array(-1, 0), 'fieldname' => $gettypes, vB_dB_Query::COLUMNS_KEY => array('fieldname', 'varname', 'text')));
        foreach ($phrases as $phrase) {
            if (isset($jsphrases["{$phrase['varname']}"])) {
                $phrase['text'] = fetch_js_safe_string($phrase['text']);
            }
            if (strpos($phrase['text'], '{1}') !== false) {
                $phrase['text'] = str_replace('%', '%%', $phrase['text']);
            }
            $phrase['text'] = str_replace(array(''), '', $phrase['text']);
            $masterlang["{$phrase['fieldname']}"]["{$phrase['varname']}"] = $phrase['text'];
        }
    }
    // get phrases for language update
    $phrasearray = $masterlang;
    $phrasetemplate = array();
    $phrases = vB::getDbAssertor()->assertQuery('vBForum:phrase', array('languageid' => $languageid, 'fieldname' => $gettypes, vB_dB_Query::COLUMNS_KEY => array('fieldname', 'varname', 'text')));
    foreach ($phrases as $phrase) {
        if (isset($jsphrases["{$phrase['varname']}"])) {
            $phrase['text'] = fetch_js_safe_string($phrase['text']);
        }
        if (strpos($phrase['text'], '{1}') !== false) {
            $phrase['text'] = str_replace('%', '%%', $phrase['text']);
        }
        $phrasearray["{$phrase['fieldname']}"]["{$phrase['varname']}"] = $phrase['text'];
    }
    unset($phrase);
    if (!empty($phrasearray)) {
        vB::getDbAssertor()->assertQuery('vBForum:rebuildLanguage', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_METHOD, 'phrasearray' => $phrasearray, 'languageid' => $languageid));
    }
    vB_Cache::instance()->event("vB_Language_languageCache");
}
/**
* Reads a language or languages and updates the language db table with the denormalized phrase cache
*
* @param	integer	ID of language to be built; if -1, build all
* @param	integer	Not sure actually... any ideas?
* @param	boolean.  Wether to reset the static vars the function uses to cache items for recursing
* 			when we we build the master language.  Otherwise if we attempt to call this function
* 			twice in the same pageload we don't actually manage to update any changes after the first
* 			call.
* 			The better approach would be to use an internal function and a master function
* 			that generates the cached values once and passes them in.
* 			However that means unwinding this function which works but is... odd.
*/
function build_language($languageid = -1, $phrasearray = 0, $reset_static = true)
{
    global $vbulletin;
    static $masterlang, $jsphrases = null;
    if ($reset_static) {
        $masterlang = null;
        $jsphrases = null;
    }
    // load js safe phrases
    if ($jsphrases === null) {
        require_once DIR . '/includes/class_xml.php';
        $xmlobj = new vB_XML_Parser(false, DIR . '/includes/xml/js_safe_phrases.xml');
        $safephrases = $xmlobj->parse();
        $jsphrases = array();
        if (is_array($safephrases['phrase'])) {
            foreach ($safephrases['phrase'] as $varname) {
                $jsphrases["{$varname}"] = true;
            }
        }
        unset($safephrases, $xmlobj);
    }
    // update all languages if this is the master language
    if ($languageid == -1) {
        $languages = $vbulletin->db->query_read("SELECT languageid FROM " . TABLE_PREFIX . "language");
        while ($language = $vbulletin->db->fetch_array($languages)) {
            build_language($language['languageid'], 0, false);
        }
        return;
    }
    // get phrase types for language update
    $gettypes = array();
    $getphrasetypes = $vbulletin->db->query_read("\n\t\tSELECT fieldname\n\t\tFROM " . TABLE_PREFIX . "phrasetype\n\t\tWHERE editrows <> 0 AND\n\t\t\tspecial = 0\n\t");
    while ($getphrasetype = $vbulletin->db->fetch_array($getphrasetypes)) {
        $gettypes[] = "'" . $vbulletin->db->escape_string($getphrasetype['fieldname']) . "'";
    }
    unset($getphrasetype);
    $vbulletin->db->free_result($getphrasetypes);
    if (empty($masterlang)) {
        $masterlang = array();
        $phrases = $vbulletin->db->query_read("\n\t\t\tSELECT fieldname, varname, text, languageid\n\t\t\tFROM " . TABLE_PREFIX . "phrase\n\t\t\tWHERE languageid IN(-1,0) AND\n\t\t\t\tfieldname IN (" . implode(',', $gettypes) . ")\n\t\t");
        while ($phrase = $vbulletin->db->fetch_array($phrases)) {
            if (isset($jsphrases["{$phrase['varname']}"])) {
                $phrase['text'] = fetch_js_safe_string($phrase['text']);
            }
            if (strpos($phrase['text'], '{1}') !== false) {
                $phrase['text'] = str_replace('%', '%%', $phrase['text']);
            }
            $phrase['text'] = str_replace(array('', ''), '', $phrase['text']);
            if (!isset($masterlang["{$phrase['fieldname']}"]["{$phrase['varname']}"]) or !$phrase['languageid']) {
                $masterlang["{$phrase['fieldname']}"]["{$phrase['varname']}"] = $phrase['text'];
            }
        }
    }
    // get phrases for language update
    $phrasearray = $masterlang;
    $phrasetemplate = array();
    $phrases = $vbulletin->db->query_read("\n\t\tSELECT varname, text, fieldname\n\t\tFROM " . TABLE_PREFIX . "phrase\n\t\tWHERE languageid = {$languageid} AND fieldname IN (" . implode(',', $gettypes) . ")\n\t");
    while ($phrase = $vbulletin->db->fetch_array($phrases, DBARRAY_BOTH)) {
        if (isset($jsphrases["{$phrase['varname']}"])) {
            $phrase['text'] = fetch_js_safe_string($phrase['text']);
        }
        if (strpos($phrase['text'], '{1}') !== false) {
            $phrase['text'] = str_replace('%', '%%', $phrase['text']);
        }
        $phrasearray["{$phrase['fieldname']}"]["{$phrase['varname']}"] = $phrase['text'];
    }
    unset($phrase);
    $vbulletin->db->free_result($phrases);
    $SQL = 'title = title';
    foreach ($phrasearray as $fieldname => $phrases) {
        ksort($phrases);
        $cachefield = $fieldname;
        $phrases = preg_replace('/\\{([0-9]+)\\}/siU', '%\\1$s', $phrases);
        $cachetext = $vbulletin->db->escape_string(serialize($phrases));
        $SQL .= ", phrasegroup_{$cachefield} = '{$cachetext}'";
    }
    // This only loads the last dateline for the ckeditor group, if this functionality is ever needed for other groups,
    // just move this code block into the foreach() above
    $maxdateline = $vbulletin->db->query_first("\n\t\tSELECT MAX(dateline) AS dateline\n\t\tFROM " . TABLE_PREFIX . "phrase\n\t\tWHERE\n\t\t\tlanguageid IN ({$languageid},-1)\n\t\t\t\tAND\n\t\t\tfieldname = 'ckeditor'\n\t");
    $info['ckeditor'] = array('maxdateline' => $maxdateline['dateline']);
    $SQL .= ", phrasegroupinfo = '" . $vbulletin->db->escape_string(serialize($info)) . "'";
    $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "language SET {$SQL} WHERE languageid = {$languageid}");
}
    protected function print_color_input_row($title, $stylevarid, $color_value, $stylevar_value)
    {
        global $vbphrase;
        $cp = "";
        $color_value = htmlspecialchars_uni($color_value);
        //only include the colorpicker on the first color element.
        if (self::$need_colorpicker) {
            //construct all of the markup/javascript for the color picker.
            //set from construct_color_picker
            global $colorPickerWidth, $colorPickerType;
            $cp = '<script type="text/javascript" src="' . vB::getDatastore()->getOption('bburl') . '/clientscript/vbulletin_cpcolorpicker.js?v=' . vB::getDatastore()->getOption('simpleversion') . '"></script>' . "\n";
            $cp .= construct_color_picker(11);
            $js_phrases = array();
            foreach (array('css_value_invalid', 'color_picker_not_ready') as $phrasename) {
                $js_phrases[] = "vbphrase.{$phrasename} = \"" . fetch_js_safe_string($vbphrase["{$phrasename}"]) . "\"";
            }
            $js_phrases = implode(";\r\n\t", $js_phrases) . ";\r\n";
            $cp .= '
					<script type="text/javascript">
					<!--
					var bburl = "' . vB::getDatastore()->getOption('bburl') . '";
					var cpstylefolder = "' . vB::getDatastore()->getOption('cpstylefolder') . '";
					var colorPickerWidth = ' . intval($colorPickerWidth) . ';
					var colorPickerType = ' . intval($colorPickerType) . ';
					if(vbphrase == undefined) {vbphrase = new Object();}
					' . $js_phrases . '

					vBulletin.events.systemInit.subscribe(function()
					{
						init_color_preview();
					});
					var cleargifurl = "' . vB::getDatastore()->getOption('bburl') . '/' . vB::getDatastore()->getOption('cleargifurl') . '";
					//-->
				</script>';
            self::$need_colorpicker = false;
        }
        $vb5_config =& vB::getConfig();
        $id = 'color_' . self::$count;
        $color_name = 'stylevar[' . $stylevarid . '][color]';
        $title_attr = $vb5_config['Misc']['debug'] ? " title=\"name=&quot;{$color_name}&quot;\"" : '';
        $cell = "<div id=\"ctrl_{$color_name}\" class=\"color_input_container\">" . "<input type=\"text\" name=\"{$color_name}\" id=\"{$id}\" " . "value=\"{$color_value}\" " . "tabindex=\"1\" {$title_attr} />" . "</div>";
        $color_preview = '<div id="preview_' . self::$count . '" class="colorpreview" onclick="open_color_picker(' . self::$count . ', event)"></div>';
        $or_stylevar = $this->fetch_stylevar_input($stylevarid, 'color', $stylevar_value);
        print_label_row($title, $cp . $cell . $color_preview . $or_stylevar, '', 'top', $color_name);
        construct_hidden_code('stylevar[' . $stylevarid . '][original_color]', $color_value, false);
        self::$count++;
    }
/**
* Reads a language or languages and updates the language db table with the denormalized phrase cache
*
* @param	integer	ID of language to be built; if -1, build all
* @param	integer	Not sure actually... any ideas?	
* @param	boolean.  Wether to reset the static vars the function uses to cache items for recursing
* 			when we we build the master language.  Otherwise if we attempt to call this function
* 			twice in the same pageload we don't actually manage to update any changes after the first
* 			call. 
* 			The better approach would be to use an internal function and a master function t
* 			hat generates the cached values once and passes them in.
* 			However that means unwinding this function which works but is... odd.  
*/
function build_language($languageid = -1, $phrasearray = 0, $reset_static=true)
{
	global $vbulletin;
	static $masterlang, $jsphrases = null;

	if($reset_static)
	{
		$masterlang = null;
		$jsphrases = null; 
	}

	// load js safe phrases
	if ($jsphrases === null)
	{
		require_once(DIR . '/includes/class_xml.php');
		$xmlobj = new vB_XML_Parser(false, DIR . '/includes/xml/js_safe_phrases.xml');
		$safephrases = $xmlobj->parse();

		$jsphrases = array();

		if (is_array($safephrases['phrase']))
		{
			foreach ($safephrases['phrase'] AS $varname)
			{
				$jsphrases["$varname"] = true;
			}
		}
		unset($safephrases, $xmlobj);
	}


	// update all languages if this is the master language
	if ($languageid == -1)
	{
		$languages = $vbulletin->db->query_read("SELECT languageid FROM " . TABLE_PREFIX . "language");
		while ($language = $vbulletin->db->fetch_array($languages))
		{
			build_language($language['languageid'], 0, false);
		}
		return;
	}

	// get phrase types for language update
	$gettypes = array();
	$getphrasetypes = $vbulletin->db->query_read("
		SELECT fieldname
		FROM " . TABLE_PREFIX . "phrasetype
		WHERE editrows <> 0 AND
			special = 0
	");
	while ($getphrasetype = $vbulletin->db->fetch_array($getphrasetypes))
	{
		$gettypes[] = "'" . $vbulletin->db->escape_string($getphrasetype['fieldname']) . "'";
	}
	unset($getphrasetype);
	$vbulletin->db->free_result($getphrasetypes);

	if (empty($masterlang))
	{
		$masterlang = array();

		$phrases = $vbulletin->db->query_read("
			SELECT fieldname, varname, text
			FROM " . TABLE_PREFIX . "phrase
			WHERE languageid IN(-1,0) AND
				fieldname IN (" . implode(',', $gettypes) . ")
		");
		while ($phrase = $vbulletin->db->fetch_array($phrases))
		{
			if (isset($jsphrases["$phrase[varname]"]))
			{
				$phrase['text'] = fetch_js_safe_string($phrase['text']);
			}
			if (strpos($phrase['text'], '{1}') !== false)
			{
				$phrase['text'] = str_replace('%', '%%', $phrase['text']);
			}

			$phrase['text'] = str_replace(
				array('', ''),
				'',
				$phrase['text']
			);

			$masterlang["{$phrase['fieldname']}"]["$phrase[varname]"] = $phrase['text'];
		}
	}

	// get phrases for language update
	$phrasearray = $masterlang;
	$phrasetemplate = array();
	$phrases = $vbulletin->db->query_read("
		SELECT varname, text, fieldname
		FROM " . TABLE_PREFIX . "phrase
		WHERE languageid = $languageid AND fieldname IN (" . implode(',', $gettypes) . ")
	");

	while ($phrase = $vbulletin->db->fetch_array($phrases, DBARRAY_BOTH))
	{
		if (isset($jsphrases["$phrase[varname]"]))
		{
			$phrase['text'] = fetch_js_safe_string($phrase['text']);
		}
		if (strpos($phrase['text'], '{1}') !== false)
		{
			$phrase['text'] = str_replace('%', '%%', $phrase['text']);
		}
		$phrasearray["{$phrase['fieldname']}"]["$phrase[varname]"] = $phrase['text'];
	}
	unset($phrase);
	$vbulletin->db->free_result($phrases);

	$SQL = 'title = title';

	foreach($phrasearray as $fieldname => $phrases)
	{
		ksort($phrases);
		$cachefield = $fieldname;
		$phrases = preg_replace('/\{([0-9]+)\}/siU', '%\\1$s', $phrases);
		$cachetext = $vbulletin->db->escape_string(serialize($phrases));
		$SQL .= ", phrasegroup_$cachefield = '$cachetext'";
	}

	$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "language SET $SQL WHERE languageid = $languageid");

}
Example #10
0
    }
    $user['threadedmode'] = $threaddisplaymode;
    // make array for daysprune menu
    $pruneoptions = array('0' => '- ' . $vbphrase['use_forum_default'] . ' -', '1' => $vbphrase['show_threads_from_last_day'], '2' => construct_phrase($vbphrase['show_threads_from_last_x_days'], 2), '7' => $vbphrase['show_threads_from_last_week'], '10' => construct_phrase($vbphrase['show_threads_from_last_x_days'], 10), '14' => construct_phrase($vbphrase['show_threads_from_last_x_weeks'], 2), '30' => $vbphrase['show_threads_from_last_month'], '45' => construct_phrase($vbphrase['show_threads_from_last_x_days'], 45), '60' => construct_phrase($vbphrase['show_threads_from_last_x_months'], 2), '75' => construct_phrase($vbphrase['show_threads_from_last_x_days'], 75), '100' => construct_phrase($vbphrase['show_threads_from_last_x_days'], 100), '365' => $vbphrase['show_threads_from_last_year'], '-1' => $vbphrase['show_all_threads_guser']);
    if ($pruneoptions["{$user['daysprune']}"] == '') {
        $pruneoptions["{$user['daysprune']}"] = construct_phrase($vbphrase['show_threads_from_last_x_days'], $user['daysprune']);
    }
    // Legacy Hook 'useradmin_edit_start' Removed //
    if ($vbulletin->GPC['userid']) {
        // a little javascript for the options menus
        ?>
		<script type="text/javascript">
		function pick_a_window(url)
		{
			var modcpurl = "<?php 
        echo fetch_js_safe_string($vb5_config['Misc']['modcpdir']);
        ?>
";
			if (url != '')
			{
				if (url.substr(0, 3) == '../' && url.substr(3, modcpurl.length) != modcpurl)
				{
					window.open(url);
				}
				else
				{
					window.location = url;
				}
			}
			return false;
		}
Example #11
0
	);
	if ($pruneoptions["$user[daysprune]"] == '')
	{
		$pruneoptions["$user[daysprune]"] = construct_phrase($vbphrase['show_threads_from_last_x_days'], $user['daysprune']);
	}

	($hook = vBulletinHook::fetch_hook('useradmin_edit_start')) ? eval($hook) : false;

	if ($vbulletin->GPC['userid'])
	{
		// a little javascript for the options menus
		?>
		<script type="text/javascript">
		function pick_a_window(url)
		{
			var modcpurl = "<?php echo(fetch_js_safe_string($vbulletin->config['Misc']['modcpdir'])); ?>";
			if (url != '')
			{
				if (url.substr(0, 3) == '../' && url.substr(3, modcpurl.length) != modcpurl)
				{
					window.open(url);
				}
				else
				{
					window.location = url;
				}
			}
			return false;
		}
		</script>
		<?php
/**
* Prints a row containing template search javascript controls
*/
function print_template_javascript($textarea_id)
{
    $vbphrase = vB_Api::instanceInternal('phrase')->fetch(array('not_found'));
    print_phrase_ref_popup_javascript();
    echo '<script type="text/javascript" src="' . vB::getDatastore()->getOption('bburl') . '/clientscript/vbulletin_templatemgr.js?v=' . SIMPLE_VERSION . '"></script>';
    echo '<script type="text/javascript">
<!--
	var vbphrase = { \'not_found\' : "' . fetch_js_safe_string($vbphrase['not_found']) . '" };
// -->
</script>
';
    activateCodeMirror(array($textarea_id));
}