本文整理汇总了PHP中compile_template函数的典型用法代码示例。如果您正苦于以下问题:PHP compile_template函数的具体用法?PHP compile_template怎么用?PHP compile_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了compile_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createadcells
function createadcells($x_adcode)
{
global $addelimiter, $vbulletin, $vbphrase;
if (strpos($x_adcode, '</if>') !== False || strpos($x_adcode, '$') !== False) {
eval('$x_adcode = "' . compile_template($x_adcode) . '";');
}
$x_adcoded = explode($addelimiter, $x_adcode);
foreach ($x_adcoded as $x_adcode) {
$cell++;
$total++;
if ($total != count($x_adcoded)) {
$x_adcode_cells .= '<td class="alt1" style="width:' . 100 / $vbulletin->options['adintegrate_sponsors_rows'] . '%">' . $x_adcode . '</td>';
if ($cell == $vbulletin->options['adintegrate_sponsors_rows']) {
$x_adcode_cells .= '</tr><tr>';
$cell = '0';
}
} else {
$colspan = $total % ($vbulletin->options['adintegrate_sponsors_rows'] + $cell);
if ($colspan == '1') {
$colspan = '2';
}
$x_adcode_cells .= '<td class="alt1" colspan="' . $colspan . '">' . $x_adcode . '</td>';
}
}
return $x_adcode_cells;
}
示例2: build_bbcode_video
function build_bbcode_video($checktable = false)
{
global $vbulletin;
if ($checktable) {
$vbulletin->db->hide_errors();
$vbulletin->db->query_write("SELECT url FROM " . TABLE_PREFIX . "bbcode_video LIMIT 1");
$vbulletin->db->show_errors();
if ($vbulletin->db->errno()) {
return;
}
}
require_once DIR . '/includes/class_xml.php';
$xmlobj = new vB_XML_Parser(false, DIR . '/includes/xml/bbcode_video_vbulletin.xml');
$data = $xmlobj->parse();
if (is_array($data['provider'])) {
$insert = array();
foreach ($data['provider'] as $provider) {
$items = array();
$items['tagoption'] = "'" . $vbulletin->db->escape_string($provider['tagoption']) . "'";
$items['provider'] = "'" . $vbulletin->db->escape_string($provider['title']) . "'";
$items['url'] = "'" . $vbulletin->db->escape_string($provider['url']) . "'";
$items['regex_url'] = "'" . $vbulletin->db->escape_string($provider['regex_url']) . "'";
$items['regex_scrape'] = "'" . $vbulletin->db->escape_string($provider['regex_scrape']) . "'";
$items['embed'] = "'" . $vbulletin->db->escape_string($provider['embed']) . "'";
$insert[] = implode(", ", $items);
}
if (!empty($insert)) {
$vbulletin->db->query_write("TRUNCATE TABLE " . TABLE_PREFIX . "bbcode_video");
$vbulletin->db->query_write("\n\t\t\t\tINSERT INTO " . TABLE_PREFIX . "bbcode_video\n\t\t\t\t\t(tagoption, provider, url, regex_url, regex_scrape, embed)\n\t\t\t\tVALUES\n\t\t\t\t\t(" . implode("), (", $insert) . ")\n\t\t\t");
}
}
$firsttag = '<vb:if condition="$provider == \'%1$s\'">';
$secondtag = '<vb:elseif condition="$provider == \'%1$s\'" />';
$template = array();
$bbcodes = $vbulletin->db->query_read("\n\t\tSELECT\n\t\t\ttagoption, embed\n\t\tFROM " . TABLE_PREFIX . "bbcode_video\n\t\tORDER BY priority\n\t");
while ($bbcode = $vbulletin->db->fetch_array($bbcodes)) {
if (empty($template)) {
$template[] = sprintf($firsttag, $bbcode['tagoption']);
} else {
$template[] = sprintf($secondtag, $bbcode['tagoption']);
}
$template[] = $bbcode['embed'];
}
$template[] = "</vb:if>";
$final = implode("\r\n", $template);
$vbulletin->db->query_write("\n\t\tDELETE FROM " . TABLE_PREFIX . "template\n\t\tWHERE\n\t\t\ttitle = 'bbcode_video'\n\t\t\tAND\n\t\t\tproduct IN ('', 'vbulletin')\n\t\t\tAND\n\t\t\tstyleid = 0\n\t");
require_once DIR . '/includes/adminfunctions_template.php';
if ($exists = $vbulletin->db->query_first_slave("\n\t\tSELECT templateid\n\t\tFROM " . TABLE_PREFIX . "template\n\t\tWHERE\n\t\t\ttitle = 'bbcode_video'\n\t\t\t\tAND\n\t\t\tproduct IN ('', 'vbulletin')\n\t\t\t\tAND\n\t\t\tstyleid = -1\n\t\t")) {
$vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "template\n\t\t\tSET\n\t\t\t\ttemplate = '" . $vbulletin->db->escape_string(compile_template($final)) . "',\n\t\t\t\ttemplate_un = '" . $vbulletin->db->escape_string($final) . "',\n\t\t\t\tdateline = " . TIMENOW . ",\n\t\t\t\tusername = '" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "',\n\t\t\t\tversion = '" . $vbulletin->options['templateversion'] . "'\n\t\t\tWHERE\n\t\t\t\ttemplateid = {$exists['templateid']}\n\t\t");
} else {
$vbulletin->db->query_write("\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "template\n\t\t\t\t(template, template_un, dateline, username, templatetype, styleid, title, product, version)\n\t\t\tVALUES\n\t\t\t\t(\n\t\t\t\t\t'" . $vbulletin->db->escape_string(compile_template($final)) . "',\n\t\t\t\t\t'" . $vbulletin->db->escape_string($final) . "',\n\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t'" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "',\n\t\t\t\t\t'template',\n\t\t\t\t\t'-1',\n\t\t\t\t\t'bbcode_video',\n\t\t\t\t\t'vbulletin',\n\t\t\t\t\t'" . $vbulletin->options['templateversion'] . "'\n\t\t\t\t)\n\t\t");
}
if ($exists = $vbulletin->db->query_first_slave("\n\t\tSELECT templateid\n\t\tFROM " . TABLE_PREFIX . "template\n\t\tWHERE\n\t\t\ttitle = 'bbcode_video'\n\t\t\t\tAND\n\t\t\tproduct IN ('', 'vbulletin')\n\t\t\t\tAND\n\t\t\tstyleid = -2\n\t\t")) {
$vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "template\n\t\t\tSET\n\t\t\t\ttemplate = '" . $vbulletin->db->escape_string(compile_template($final)) . "',\n\t\t\t\ttemplate_un = '" . $vbulletin->db->escape_string($final) . "',\n\t\t\t\tdateline = " . TIMENOW . ",\n\t\t\t\tusername = '" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "',\n\t\t\t\tversion = '" . $vbulletin->options['templateversion'] . "'\n\t\t\tWHERE\n\t\t\t\ttemplateid = {$exists['templateid']}\n\t\t");
} else {
$vbulletin->db->query_write("\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "template\n\t\t\t\t(template, template_un, dateline, username, templatetype, styleid, title, product, version)\n\t\t\tVALUES\n\t\t\t\t(\n\t\t\t\t\t'" . $vbulletin->db->escape_string(compile_template($final)) . "',\n\t\t\t\t\t'" . $vbulletin->db->escape_string($final) . "',\n\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t'" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "',\n\t\t\t\t\t'template',\n\t\t\t\t\t'-2',\n\t\t\t\t\t'bbcode_video',\n\t\t\t\t\t'vbulletin',\n\t\t\t\t\t'" . $vbulletin->options['templateversion'] . "'\n\t\t\t\t)\n\t\t");
}
}
示例3: step_1
/**
* Step #1
*
*/
function step_1()
{
$doads = array('thread_first_post_content' => 1, 'thread_last_post_content' => 1);
require_once DIR . '/includes/adminfunctions_template.php';
$ads = $this->db->query_read("\n\t\t\tSELECT adlocation, COUNT( * ) AS count\n\t\t\tFROM " . TABLE_PREFIX . "ad\n\t\t\tWHERE\n\t\t\t\tadlocation IN ('" . implode('\', \'', array_keys($doads)) . "')\n\t\t\t\t\tAND\n\t\t\t\tactive = 1\n\t\t\tGROUP BY\n\t\t\t\tadlocation\n\t\t");
while ($ad = $this->db->fetch_array($ads)) {
unset($doads[$ad['adlocation']]);
}
$count = 0;
foreach (array_keys($doads) as $ad) {
$count++;
$template_un = '';
$template = compile_template($template_un);
// This template should never be false since it goes in empty but to be consistent
if ($template === false) {
$this->show_message(sprintf($this->phrase['vbphrase']['compile_template_x_failed'], 'ad_' . $ad));
} else {
$this->run_query(sprintf($this->phrase['core']['altering_x_table'], 'template', $count, count($doads)), "UPDATE " . TABLE_PREFIX . "template\n\t\t\t\t\tSET\n\t\t\t\t\t\ttemplate = '" . $this->db->escape_string($template) . "',\n\t\t\t\t\t\ttemplate_un = '',\n\t\t\t\t\t\tdateline = " . TIMENOW . "\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tstyleid IN (-1,0)\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\ttitle = 'ad_" . $this->db->escape_string($ad) . "'\n\t\t\t\t\t");
}
}
if (!$count) {
$this->skip_message();
}
}
示例4: build_bbcode_video
function build_bbcode_video()
{
global $vbulletin;
require_once(DIR . '/includes/class_xml.php');
$xmlobj = new vB_XML_Parser(false, DIR . '/includes/xml/bbcode_video_vbulletin.xml');
$data = $xmlobj->parse();
if (is_array($data['provider']))
{
$insert = array();
foreach ($data['provider'] AS $provider)
{
$items = array();
$items['tagoption'] = "'" . $vbulletin->db->escape_string($provider['tagoption']) . "'";
$items['provider'] = "'" . $vbulletin->db->escape_string($provider['title']) . "'";
$items['url'] = "'" . $vbulletin->db->escape_string($provider['url']) . "'";
$items['regex_url'] = "'" . $vbulletin->db->escape_string($provider['regex_url']) . "'";
$items['regex_scrape'] = "'" . $vbulletin->db->escape_string($provider['regex_scrape']) . "'";
$items['embed'] = "'" . $vbulletin->db->escape_string($provider['embed']) . "'";
$insert[] = implode(", ", $items);
}
if (!empty($insert))
{
$vbulletin->db->query_write("TRUNCATE TABLE " . TABLE_PREFIX . "bbcode_video");
$vbulletin->db->query_write("
INSERT INTO " . TABLE_PREFIX . "bbcode_video
(tagoption, provider, url, regex_url, regex_scrape, embed)
VALUES
(" . implode("), (", $insert) . ")
");
}
}
$firsttag = '<vb:if condition="$provider == \'%1$s\'">';
$secondtag = '<vb:elseif condition="$provider == \'%1$s\'" />';
$template = array();
$bbcodes = $vbulletin->db->query_read("
SELECT
tagoption, embed
FROM " . TABLE_PREFIX . "bbcode_video
ORDER BY priority
");
while ($bbcode = $vbulletin->db->fetch_array($bbcodes))
{
if (empty($template))
{
$template[] = sprintf($firsttag, $bbcode['tagoption']);
}
else
{
$template[] = sprintf($secondtag, $bbcode['tagoption']);
}
$template[] = $bbcode['embed'];
}
$template[] = "</vb:if>";
$final = implode("\r\n", $template);
require_once(DIR . '/includes/adminfunctions_template.php');
if ($exists = $vbulletin->db->query_first_slave("
SELECT templateid
FROM " . TABLE_PREFIX . "template
WHERE
title = 'bbcode_video'
AND
product IN ('', 'vbulletin')
AND
styleid = -1
"))
{
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "template
SET
template = '" . $vbulletin->db->escape_string(compile_template($final)) . "',
template_un = '" . $vbulletin->db->escape_string($final) . "',
dateline = " . TIMENOW . ",
username = '" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "',
version = '" . $vbulletin->options['templateversion'] . "'
WHERE
templateid = $exists[templateid]
");
}
else
{
$vbulletin->db->query_write("
REPLACE INTO " . TABLE_PREFIX . "template
(template, template_un, dateline, username, templatetype, styleid, title, product, version)
VALUES
(
'" . $vbulletin->db->escape_string(compile_template($final)) . "',
'" . $vbulletin->db->escape_string($final) . "',
" . TIMENOW . ",
'" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "',
'template',
'-1',
'bbcode_video',
//.........这里部分代码省略.........
示例5: build_ranks
require_once DIR . '/includes/functions_ranks.php';
build_ranks();
// rebuild the smilie cache -- something has changed in 3.5 that this fixes
build_image_cache('smilie');
// rebuild the options for the new aggressive email ban option/
// since it defaults to off but 3.0.x users are used to it being on,
// put it on for upgrades
$db->query_write("\n\t\tREPLACE INTO " . TABLE_PREFIX . "setting\n\t\t\t(varname, grouptitle, value, defaultvalue, optioncode, displayorder, advanced, volatile)\n\t\tVALUES\n\t\t\t('aggressiveemailban', 'banning', '0', '0', 'yesno', 31, 0, 1)\n\t");
build_options();
// rebuild the forum perms for the new can view thread content perm
build_forum_permissions();
// rebuild any custom templates for new variables
require_once DIR . '/includes/adminfunctions_template.php';
$customs = $db->query_read("\n\t\tSELECT templateid, template_un\n\t\tFROM " . TABLE_PREFIX . "template\n\t\tWHERE styleid <> -1 AND templatetype = 'template'\n\t");
while ($custom = $db->fetch_array($customs)) {
$newtemplate = compile_template($custom['template_un']);
$db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "template SET\n\t\t\t\ttemplate = '" . $db->escape_string($newtemplate) . "'\n\t\t\tWHERE templateid = {$custom['templateid']}\n\t\t");
}
// tell log_upgrade_step() that the script is done
define('SCRIPTCOMPLETE', true);
}
// #############################################################################
print_next_step();
print_upgrade_footer();
// ###################### Start updateattachmenttypes #######################
function build_attachment_types()
{
global $vbulletin;
$data = array();
$types = $vbulletin->db->query_read("\n\t\tSELECT extension, size, height, width, enabled, thumbnail, newwindow\n\t\tFROM " . TABLE_PREFIX . "attachmenttype\n\t\tORDER BY extension\n\t");
while ($type = $vbulletin->db->fetch_array($types)) {
示例6: step_94
/**
* Step #94 - add YUI to headinclude so things don't suddenly just stop working
*
*/
function step_94()
{
require_once DIR . '/includes/adminfunctions_template.php';
$skip = true;
$templates = $this->db->query_read("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "template\n\t\t\tWHERE styleid > 0\n\t\t\t\tAND title IN ('headinclude')\n\t\t");
while ($template = $this->db->fetch_array($templates)) {
if (strpos($template['template_un'], '$stylevar[yuipath]') !== false) {
continue;
}
$template['template_un'] = str_replace('<script type="text/javascript">' . "\r\n" . '<!--' . "\r\n" . 'var SESSIONURL = "$session[sessionurl_js]";', '<script type="text/javascript" src="$stylevar[yuipath]/yahoo-dom-event/yahoo-dom-event.js?v=$vboptions[simpleversion]"></script>' . "\n" . '<script type="text/javascript" src="$stylevar[yuipath]/connection/connection-min.js?v=$vboptions[simpleversion]"></script>' . "\n" . '<script type="text/javascript">' . "\n" . '<!--' . "\n" . 'var SESSIONURL = "$session[sessionurl_js]";', $template['template_un']);
// check in case it was newlines only
if (strpos($template['template_un'], '$stylevar[yuipath]') === false) {
$template['template_un'] = str_replace('<script type="text/javascript">' . "\n" . '<!--' . "\n" . 'var SESSIONURL = "$session[sessionurl_js]";', '<script type="text/javascript" src="$stylevar[yuipath]/yahoo-dom-event/yahoo-dom-event.js?v=$vboptions[simpleversion]"></script>' . "\n" . '<script type="text/javascript" src="$stylevar[yuipath]/connection/connection-min.js?v=$vboptions[simpleversion]"></script>' . "\n" . '<script type="text/javascript">' . "\n" . '<!--' . "\n" . 'var SESSIONURL = "$session[sessionurl_js]";', $template['template_un']);
}
$compiled_template = compile_template($template['template_un']);
if ($compiled_template === false) {
$this->show_message(sprintf($this->phrase['vbphrase']['compile_template_x_failed'], $template['title']));
} else {
$this->run_query(sprintf($this->phrase['vbphrase']['apply_critical_template_change_to_x'], $template['title'], $template['styleid']), "UPDATE " . TABLE_PREFIX . "template SET\n\t\t\t\t\t\ttemplate = '" . $this->db->escape_string($compiled_template) . "',\n\t\t\t\t\t\ttemplate_un = '" . $this->db->escape_string($template['template_un']) . "'\n\t\t\t\t\tWHERE templateid = {$template['templateid']}\n\t\t\t\t");
}
$skip = false;
}
if ($skip) {
$this->skip_message();
}
}
示例7: array
';
}
});
//-->
</script>
<?php
}
// #############################################################################
// simple update query for an existing template
if ($_POST['do'] == 'updatetemplate') {
$vbulletin->input->clean_array_gpc('p', array('title' => TYPE_STR, 'oldtitle' => TYPE_STR, 'template' => TYPE_NOTRIM, 'group' => TYPE_STR, 'product' => TYPE_STR, 'savehistory' => TYPE_BOOL, 'histcomment' => TYPE_STR, 'string' => TYPE_STR, 'searchstring' => TYPE_STR, 'expandset' => TYPE_NOHTML, 'searchset' => TYPE_NOHTML, 'return' => TYPE_STR, 'confirmerrors' => TYPE_BOOL, 'lastedit' => TYPE_UINT));
// remove escaped CDATA (just in case user is pasting template direct from an XML editor
// where the CDATA tags will have been escaped by our escaper...
// $template = xml_unescape_cdata($template);
$template_un = $vbulletin->GPC['template'];
$vbulletin->GPC['template'] = compile_template($vbulletin->GPC['template']);
// error checking on conditionals
if (empty($vbulletin->GPC['confirmerrors'])) {
$errors = check_template_errors($vbulletin->GPC['template']);
if (!empty($errors)) {
print_form_header('template', 'updatetemplate', 0, 1, '', '75%');
construct_hidden_code('confirmerrors', 1);
construct_hidden_code('title', $vbulletin->GPC['title']);
construct_hidden_code('template', $template_un);
construct_hidden_code('templateid', $vbulletin->GPC['templateid']);
construct_hidden_code('group', $vbulletin->GPC['group']);
construct_hidden_code('searchstring', $vbulletin->GPC['searchstring']);
construct_hidden_code('dostyleid', $vbulletin->GPC['dostyleid']);
construct_hidden_code('product', $vbulletin->GPC['product']);
construct_hidden_code('savehistory', intval($vbulletin->GPC['savehistory']));
construct_hidden_code('histcomment', $vbulletin->GPC['histcomment']);
示例8: IN
if ($comp and $sort and $ad_swap = $db->query_first("SELECT adid, displayorder FROM " . TABLE_PREFIX . "ad WHERE displayorder {$comp} {$ad_orig['displayorder']} ORDER BY displayorder {$sort}, title ASC LIMIT 1")) {
$db->query_write("\r\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "ad\r\n\t\t\t\t\tSET displayorder = CASE adid\r\n\t\t\t\t\t\tWHEN {$ad_orig['adid']} THEN {$ad_swap['displayorder']}\r\n\t\t\t\t\t\tWHEN {$ad_swap['adid']} THEN {$ad_orig['displayorder']}\r\n\t\t\t\t\t\tELSE displayorder END\r\n\t\t\t\t\tWHERE adid IN({$ad_orig['adid']}, {$ad_swap['adid']})\r\n\t\t\t\t");
// tell the datastore to update
$changes = true;
}
}
}
//update the ad templates
if ($changes) {
require_once DIR . '/includes/functions_ad.php';
require_once DIR . '/includes/adminfunctions_template.php';
foreach ($changed_locations as $location) {
// same as above, we're not telling user errors here, because they already confirmed the error else where
$template = wrap_ad_template(build_ad_template($location), $location);
$template_un = $template;
$template = compile_template($template);
$db->query_write("\r\n\t\t\t\tUPDATE " . TABLE_PREFIX . "template SET\r\n\t\t\t\t\ttemplate = '" . $db->escape_string($template) . "',\r\n\t\t\t\t\ttemplate_un = '" . $db->escape_string($template_un) . "',\r\n\t\t\t\t\tdateline = " . TIMENOW . ",\r\n\t\t\t\t\tusername = '" . $db->escape_string($vbulletin->userinfo['username']) . "'\r\n\t\t\t\tWHERE\r\n\t\t\t\t\ttitle = 'ad_" . $db->escape_string($location) . "'\r\n\t\t\t\t\tAND styleid IN (-1,0)\r\n\t\t\t");
}
}
$_REQUEST['do'] = 'modify';
}
// #############################################################################
// list existing ads
if ($_REQUEST['do'] == 'modify') {
print_form_header('ad', 'quickupdate');
print_column_style_code(array('width:100%', 'white-space:nowrap'));
print_table_header($vbphrase['ad_manager']);
$ad_result = $db->query("SELECT * FROM " . TABLE_PREFIX . "ad ORDER BY displayorder, title");
$ad_count = $db->num_rows($ad_result);
if ($ad_count) {
print_description_row('<label><input type="checkbox" id="allbox" checked="checked" />' . $vbphrase['toggle_active_status_for_all'] . '</label><input type="image" src="../' . $vbulletin->options['cleargifurl'] . '" name="normalsubmit" />', false, 2, 'thead" style="font-weight:normal; padding:0px 4px 0px 4px');
示例9: intval
construct_hidden_code('product', $vbulletin->GPC['product']);
construct_hidden_code('savehistory', intval($vbulletin->GPC['savehistory']));
construct_hidden_code('histcomment', $vbulletin->GPC['histcomment']);
print_table_header($vbphrase['vbulletin_message']);
print_description_row($error);
print_submit_row($vbphrase['continue'], 0, 2, $vbphrase['go_back']);
print_cp_footer();
}
// remove escaped CDATA (just in case user is pasting template direct from an XML editor
// where the CDATA tags will have been escaped by our escaper...
// $template = xml_unescape_cdata($template);
$template_un = $vbulletin->GPC['template'];
$vbulletin->GPC['template'] = compile_template($vbulletin->GPC['template'], $errors);
// error checking on conditionals
if (empty($vbulletin->GPC['confirmerrors']))
{
if (!empty($errors))
{
updatetemplate_print_error_page($template_un, construct_phrase($vbphrase['template_eval_error'], fetch_error_array($errors)));
exit;
}
$errors = check_template_errors($vbulletin->GPC['template']);
if (!empty($errors))
{
updatetemplate_print_error_page($template_un, construct_phrase($vbphrase['template_eval_error'], fetch_error_array($errors)));
exit;
示例10: step_4
/**
* Step #4 - special case for who's online: a form that should be get
*
*/
function step_4()
{
require_once DIR . '/includes/adminfunctions_template.php';
$skip = true;
$templates = $this->db->query_read("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "template\n\t\t\tWHERE styleid > 0\n\t\t\t\tAND title IN ('WHOSONLINE')\n\t\t");
while ($template = $this->db->fetch_array($templates)) {
if (strpos($template['template_un'], '<form action="online.php" method="get">') !== false) {
continue;
}
$template['template_un'] = str_replace('<form action="online.php" method="post">', '<form action="online.php" method="get">', $template['template_un']);
$compiled_template = compile_template($template['template_un']);
$skip = false;
if ($compiled_template === false) {
$this->show_message(sprintf($this->phrase['vbphrase']['compile_template_x_failed'], $template['title']));
} else {
$this->run_query(sprintf($this->phrase['vbphrase']['apply_critical_template_change_to_x'], $template['title'], $template['styleid']), "UPDATE " . TABLE_PREFIX . "template SET\n\t\t\t\t\t\ttemplate = '" . $this->db->escape_string($compiled_template) . "',\n\t\t\t\t\t\ttemplate_un = '" . $this->db->escape_string($template['template_un']) . "'\n\t\t\t\t\tWHERE templateid = {$template['templateid']}\n\t\t\t\t");
}
}
if ($skip) {
$this->skip_message();
}
}
示例11: step_12
/**
* Step #12 - rebuild ads that use the is_date criterion #36100 or browsing forum criteria #34416
*
*/
function step_12()
{
$this->show_message($this->phrase['version']['403']['rebuilding_ad_criteria']);
$ad_result = $this->db->query_read("\n\t\t\tSELECT ad.*\n\t\t\tFROM " . TABLE_PREFIX . "ad AS ad\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "adcriteria AS adcriteria ON(adcriteria.adid = ad.adid)\n\t\t\tWHERE adcriteria.criteriaid IN('is_date', 'browsing_forum_x', 'browsing_forum_x_and_children')\n\t\t");
if ($this->db->num_rows($ad_result) > 0) {
$ad_cache = array();
$ad_locations = array();
while ($ad = $this->db->fetch_array($ad_result)) {
$ad_cache["{$ad['adid']}"] = $ad;
$ad_locations[] = $ad['adlocation'];
}
require_once DIR . '/includes/functions_ad.php';
require_once DIR . '/includes/adminfunctions_template.php';
foreach ($ad_locations as $location) {
$template = wrap_ad_template(build_ad_template($location), $location);
$template_un = $template;
$template = compile_template($template);
if (template === false) {
$this->show_message(sprintf($this->phrase['vbphrase']['compile_template_x_failed'], 'ad_' . $location));
} else {
$this->run_query(sprintf($this->phrase['vbphrase']['update_table'], TABLE_PREFIX . 'templatehistory'), "\n\t\t\t\t\t\t\tUPDATE " . TABLE_PREFIX . "template SET\n\t\t\t\t\t\t\t\ttemplate = '" . $this->db->escape_string($template) . "',\n\t\t\t\t\t\t\t\ttemplate_un = '" . $this->db->escape_string($template_un) . "',\n\t\t\t\t\t\t\t\tdateline = " . TIMENOW . ",\n\t\t\t\t\t\t\t\tusername = '" . $this->db->escape_string($this->registry->userinfo['username']) . "'\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\ttitle = 'ad_" . $this->db->escape_string($location) . "'\n\t\t\t\t\t\t\t\tAND styleid IN (-1,0)\n\t\t\t\t\t\t");
}
}
build_all_styles();
}
}
示例12: intval
WHERE
layout.gridid = " . intval($gridinfo['gridid']) . "
AND
lw.layoutcolumn > $count
");
require_once(DIR . '/includes/adminfunctions_template.php');
$title = "vbcms_grid_$gridinfo[gridid]";
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "template
(styleid, title, template, template_un, dateline, username, product, version)
VALUES
(
0,
'" . $db->escape_string($title) . "',
'" . $db->escape_string(compile_template($gridinfo['gridhtml_backup'])) . "',
'" . $db->escape_string($gridinfo['gridhtml_backup']) . "',
" . TIMENOW . ",
'" . $db->escape_string($vbulletin->userinfo['username']) . "',
'vbcms',
'" . $db->escape_string($vbulletin->options['templateversion']) . "'
)
");
print_rebuild_style(-1, '', 0, 0, 0, 0);
define('CP_REDIRECT', 'cms_admin.php?do=grid');
print_stop_message('saved_grid_successfully');
}
if ($_REQUEST['do'] == 'layout')
{
示例13: 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
//.........这里部分代码省略.........
示例14: merge_success
/**
* Called when a merge succeeds (no conflicts).
*
* @param string Final merged text
* @param array Array of template info. Record returned by data method.
*/
protected function merge_success($merged_text, $template_info)
{
global $vbphrase;
$db = $this->registry->db;
$db->query_write("\n\t\t\tINSERT INTO " . TABLE_PREFIX . "templatehistory\n\t\t\t\t(styleid, title, template, dateline, username, version)\n\t\t\tVALUES\n\t\t\t\t('" . $template_info['styleid'] . "',\n\t\t\t\t'" . $db->escape_string($template_info['title']) . "',\n\t\t\t\t'" . $db->escape_string($template_info['customtext']) . "',\n\t\t\t\t{$template_info['dateline']},\n\t\t\t\t'" . $db->escape_string($template_info['username']) . "',\n\t\t\t\t'" . $db->escape_string($template_info['version']) . "')\n\t\t");
$savedtemplateid = $db->insert_id();
$db->query_write("\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "templatemerge\n\t\t\t\t(templateid, template, version, savedtemplateid)\n\t\t\tVALUES\n\t\t\t\t({$template_info['templateid']},\n\t\t\t\t'" . $db->escape_string($template_info['oldmastertext']) . "',\n\t\t\t\t'" . $db->escape_string($template_info['oldmasterversion']) . "',\n\t\t\t\t" . intval($savedtemplateid) . "\n\t\t\t\t)\n\t\t");
vB::getDbAssertor()->update('template', array('styleid' => $template_info['styleid'], 'templatetype' => 'template', 'title' => $template_info['title'], 'template' => compile_template($merged_text), 'template_un' => $merged_text, 'dateline' => vB::getRequest()->getTimeNow(), 'username' => !empty($vbphrase['system']) ? $vbphrase['system'] : 'System', 'version' => $this->merge_version, 'product' => $template_info['product'], 'mergestatus' => 'merged'), array('templateid' => $template_info["templateid"]));
if ($this->show_output) {
return $this->output_merge_success($merged_text, $template_info);
}
}
示例15: install_product
//.........这里部分代码省略.........
}
$assertor->insertMultiple('productcode', array('productid', 'version', 'installcode', 'uninstallcode'), $productCodes);
}
if (is_array($dependencies)) {
// dependencies met, codes run -- now we can insert the dependencies into the DB
$productDependencies = array();
foreach ($dependencies as $dependency) {
/* insert query */
$productDependencies[] = array('productid' => $info['productid'], 'dependencytype' => $dependency['dependencytype'], 'parentproductid' => $dependency['parentproductid'], 'minversion' => $dependency['minversion'], 'maxversion' => $dependency['maxversion']);
}
$assertor->insertMultiple('productdependency', array('productid', 'dependencytype', 'parentproductid', 'minversion', 'maxversion'), $productDependencies);
}
/* 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])) {