Exemplo n.º 1
0
function cache_templates($path, $newlang)
{
    global $language;
    global $smarty;
    global $tikidomain;
    $oldlang = $language;
    $language = $newlang;
    if (!$path or !is_dir($path)) {
        return 0;
    }
    if ($dir = opendir($path)) {
        while (false !== ($file = readdir($dir))) {
            $a = explode(".", $file);
            $ext = strtolower(end($a));
            if (substr($file, 0, 1) == "." or $file == 'CVS') {
                continue;
            }
            if (is_dir($path . "/" . $file)) {
                $language = $oldlang;
                cache_templates($path . "/" . $file, $newlang);
                $language = $newlang;
            } else {
                if ($ext == "tpl") {
                    $file = substr($path . "/" . $file, 10);
                    $comppath = $smarty->_get_compile_path($file);
                    //rewrite the language thing, see setup_smarty.php
                    if ($smarty->use_sub_dirs) {
                        $comppath = preg_replace("#/" . $oldlang . "/#", "/" . $newlang . "/", $comppath, 1);
                    } else {
                        $comppath = preg_replace("#/" . $tikidomain . $oldlang . "#", "/" . $tikidomain . $newlang, $comppath, 1);
                    }
                    if (!$smarty->_is_compiled($file, $comppath)) {
                        $smarty->_compile_resource($file, $comppath);
                    }
                }
            }
        }
        closedir($dir);
    }
    $language = $oldlang;
}
Exemplo n.º 2
0
function fetch_template($templatetitle)
{
    global $con;
    /*
    cache_templates has already been run
    for anything previously listed
    */
    if (!$con->templatecache[$templatetitle]) {
        if (!parsed_is_current($templatetitle)) {
            // not cached not parsed
            parse_template($templatetitle);
        }
        cache_templates(array($templatetitle));
    }
    /*
    If it was cached to begin with, we're good
    If it was uncached but parsed, it's now cached and we're good
    If it was uncached and unparsed, both are handled and we're good
    */
    $template = $con->templatecache[$templatetitle];
    return $template;
}
Exemplo n.º 3
0
{
	$passworddaysold = floor((TIMENOW - $vbulletin->userinfo['passworddate']) / 86400);

	if ($passworddaysold >= $permissions['passwordexpires'])
	{
		exec_header_redirect($vbulletin->options['bburl'] . '/' . $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q']);
	}
}

verify_ip_ban();

$cache_templates = array('ad_archive_above_content1', 'ad_archive_above_content2', 'ad_archive_below_content');

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

cache_templates($cache_templates, $style['templatelist']);
unset($cache_templates);

// #########################################################################################
// ###################### ARCHIVE FUNCTIONS ################################################

// function to list forums in their correct order and nesting
function print_archive_forum_list($parentid = -1, $indent = '')
{
	global $vbulletin;

	$output = '';

	if (empty($vbulletin->iforumcache))
	{
		$forums = $vbulletin->db->query_read_slave("
Exemplo n.º 4
0
/**
*	Switch the style for rendering
*	This really should be part of the bootstrap code except:
*	1) We don't actually load the bootstrap in the admincp
* 2) There is a lot to the style load that isn't easy to redo (header/footer templates for example)
*
* This handles the stylevars and template lists -- including reloading the template cache.
* This is enough to handle the css template rendering, but probably won't work for anything
* more complicated.
*/
function switch_css_style($styleid, $templates)
{
	global $vbulletin;
	$styletemp = $vbulletin->db->query_first ("
		SELECT *
		FROM " . TABLE_PREFIX . "style
		WHERE  styleid = " . intval($styleid)
	);

	if (!$styletemp)
	{
		return false;
	}

	global $style;
	$style = $styletemp;

	$vbulletin->stylevars = unserialize($style['newstylevars']);
	fetch_stylevars($style, $vbulletin->userinfo);

	global $templateassoc;
	//clear the template cache, otherwise we might get old templates
	$vbulletin->templatecache = array();
	$templateassoc = null;
	cache_templates($templates, $style['templatelist']);
}
Exemplo n.º 5
0
    $globaltemplates[] = 'humanverify_' . strtolower($vbulletin->options['hv_type']);
}
// templates to be included in every single page...
$globaltemplates = array_merge($globaltemplates, array('header', 'footer', 'headinclude', 'ad_header_logo', 'ad_header_end', 'ad_navbar_below', 'ad_footer_start', 'ad_footer_end', 'pm_popup_script', 'navbar', 'navbar_link', 'navbar_noticebit', 'navbar_notifications_menubit', 'forumjump', 'gobutton', 'option', 'pagenav', 'pagenav_curpage', 'pagenav_pagelink', 'pagenav_pagelinkrel', 'threadbit_pagelink', 'spacer_open', 'spacer_close', 'STANDARD_ERROR', 'STANDARD_REDIRECT'));
// if we are in a message editing page then get the editor templates
$show['editor_css'] = false;
if (defined('GET_EDIT_TEMPLATES')) {
    $_get_edit_templates = explode(',', GET_EDIT_TEMPLATES);
    if (GET_EDIT_TEMPLATES === true or in_array($_REQUEST['do'], $_get_edit_templates)) {
        $globaltemplates = array_merge($globaltemplates, array('editor_toolbar_on', 'editor_smilie', 'editor_css', 'editor_clientscript', 'editor_toolbar_off', 'editor_jsoptions_font', 'editor_jsoptions_size', 'editor_smiliebox', 'editor_smiliebox_category', 'editor_smiliebox_row', 'editor_smiliebox_straggler', 'bbcode_code', 'bbcode_html', 'bbcode_php', 'bbcode_quote', 'newpost_threadmanage', 'newpost_disablesmiliesoption', 'newpost_preview', 'newpost_quote', 'posticonbit', 'posticons', 'newpost_usernamecode', 'newpost_errormessage', 'forumrules'));
        $show['editor_css'] = true;
    }
}
($hook = vBulletinHook::fetch_hook('cache_templates')) ? eval($hook) : false;
// now get all the templates we have specified
cache_templates($globaltemplates, $style['templatelist']);
unset($globaltemplates, $actiontemplates, $_get_edit_templates, $_templatedo);
// #############################################################################
// initialize $template_hook variable - used for hooks within templates
$template_hook = array();
// #############################################################################
// get style variables
$stylevar = fetch_stylevars($style, $vbulletin->userinfo);
if (defined('CSRF_ERROR')) {
    define('VB_ERROR_LITE', true);
    eval('$headinclude = "' . fetch_template('headinclude') . '";');
    $ajaxerror = $vbulletin->GPC['ajax'] ? '_ajax' : '';
    switch (CSRF_ERROR) {
        case 'missing':
            eval(standard_error(fetch_error('security_token_missing', $vbulletin->options['contactuslink'])));
            break;
Exemplo n.º 6
0
$vbulletin->nozip = true;
$api = $db->query_first_slave("SELECT * FROM " . TABLE_PREFIX . "paymentapi WHERE classname = '" . $db->escape_string($vbulletin->GPC['method']) . "'");
if (!empty($api)) {
    $subobj = new vB_PaidSubscription($vbulletin);
    if (file_exists(DIR . '/includes/paymentapi/class_' . $api['classname'] . '.php')) {
        require_once DIR . '/includes/paymentapi/class_' . $api['classname'] . '.php';
        $api_class = 'vB_PaidSubscriptionMethod_' . $api['classname'];
        $apiobj = new $api_class($vbulletin);
        // at this point we know if the system is going to want to display feedback, so do the appropriate queries here
        if ($apiobj->display_feedback) {
            // initialize $vbphrase and set language constants
            $vbphrase = init_language();
            $vbulletin->userinfo['styleid'] = $vbulletin->options['styleid'];
            $style = $db->query_first_slave("\n\t\t\t\tSELECT *\n\t\t\t\tFROM " . TABLE_PREFIX . "style\n\t\t\t\tWHERE styleid = " . intval($vbulletin->options['styleid']));
            define('STYLEID', $style['styleid']);
            cache_templates(array('STANDARD_REDIRECT', 'STANDARD_ERROR', 'STANDARD_ERROR_LITE', 'headinclude'), $style['templatelist']);
            $stylevar = fetch_stylevars($style, $vbulletin->userinfo);
            $headinclude = '<base href="' . $vbulletin->options['bburl'] . '/" />';
            eval('$headinclude .= "' . fetch_template('headinclude') . '";');
        }
        if (!empty($api['settings'])) {
            // need to convert this from a serialized array with types to a single value
            $apiobj->settings = $subobj->construct_payment_settings($api['settings']);
        }
        if ($apiobj->verify_payment()) {
            // its a valid payment now lets check transactionid
            $transaction = $db->query_first("\n\t\t\t\tSELECT *\n\t\t\t\tFROM " . TABLE_PREFIX . "paymenttransaction\n\t\t\t\tWHERE transactionid = '" . $db->escape_string($apiobj->transaction_id) . "'\n\t\t\t\t\tAND paymentapiid = {$api['paymentapiid']}\n\t\t\t");
            if (($apiobj->type == 2 or empty($transaction) and $apiobj->type == 1) and $vbulletin->options['paymentemail']) {
                if (!$vbphrase) {
                    // initialize $vbphrase and set language constants
                    $vbphrase = init_language();
Exemplo n.º 7
0
 /**
  * Caches the generally required templates and the specifically requested templates.
  *
  * @param	string	Serialized array of template name => template id pairs
  */
 protected function cache_templates($template_ids)
 {
     global $vbulletin, $show;
     $cache = is_array($this->cache_templates) ? $this->cache_templates : array();
     // Choose proper human verification template
     if ($vbulletin->options['hv_type'] and in_array('humanverify', $cache)) {
         $cache[] = 'humanverify_' . strtolower($vbulletin->options['hv_type']);
     }
     // templates to be included in every single page...
     $cache = array_merge($cache, array('header', 'footer', 'headinclude', 'headinclude_bottom', 'ad_header_logo', 'ad_header_end', 'ad_navbar_below', 'ad_footer_start', 'ad_footer_end', 'ad_global_header1', 'ad_global_header2', 'ad_global_below_navbar', 'ad_global_above_footer', 'pm_popup_script', 'memberaction_dropdown', 'navbar', 'navbar_link', 'navbar_noticebit', 'navbar_notifications_menubit', 'forumjump', 'forumjump_link', 'forumjump_subforum', 'gobutton', 'option', 'pagenav', 'pagenav_curpage', 'pagenav_pagelink', 'pagenav_pagelinkrel', 'threadbit_pagelink', 'spacer_open', 'spacer_close', 'STANDARD_ERROR', 'STANDARD_REDIRECT', 'facebook_header', 'facebook_footer', 'facebook_opengraph'));
     // if we are in a message editing page then get the editor templates
     $show['editor_css'] = false;
     if (defined('GET_EDIT_TEMPLATES')) {
         $_get_edit_templates = explode(',', GET_EDIT_TEMPLATES);
         if (GET_EDIT_TEMPLATES === true or in_array($_REQUEST['do'], $_get_edit_templates)) {
             $cache = array_merge($cache, array('editor_toolbar_on', 'editor_smilie', 'editor_clientscript', 'editor_toolbar_off', 'editor_smilie_category', 'editor_smilie_row', 'editor_toolbar_fontname', 'editor_toolbar_fontsize', 'editor_toolbar_colors', 'editor_smiliebox', 'bbcode_code', 'bbcode_html', 'bbcode_php', 'bbcode_quote', 'bbcode_video', 'newpost_threadmanage', 'newpost_disablesmiliesoption', 'newpost_preview', 'newpost_quote', 'posticonbit', 'posticons', 'newpost_usernamecode', 'newpost_errormessage', 'forumrules'));
             $show['editor_css'] = true;
         }
     }
     // Legacy Hook 'cache_templates' Removed //
     cache_templates($cache, $template_ids);
 }
Exemplo n.º 8
0
/**
 * cache_templates 
 * 
 * @param array $pPath 
 * @param array $pOldLang 
 * @param array $pNewLang 
 * @access public
 * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure
 */
function cache_templates($pPath, $pOldLang, $pNewLang)
{
    global $gBitLanguage, $gBitSmarty;
    if (!$pPath or !is_dir($pPath)) {
        return 0;
    }
    if ($dir = opendir($pPath)) {
        while (FALSE !== ($file = readdir($dir))) {
            $a = explode(".", $file);
            $ext = strtolower(end($a));
            if (substr($file, 0, 1) == "." or $file == 'CVS') {
                continue;
            }
            if (is_dir($pPath . "/" . $file)) {
                cache_templates($pPath . "/" . $file, $pOldLang, $pNewLang);
            } else {
                if ($ext == "tpl") {
                    $file = str_replace('//', '/', $pPath . "/" . $file);
                    $gBitLanguage->setLanguage($pNewLang);
                    $gBitSmarty->verifyCompileDir();
                    $comppath = $gBitSmarty->_get_compile_path($file);
                    $gBitLanguage->setLanguage($pOldLang);
                    // ignore files in sudirectories of templates/ - will break stuff as in the case of phpbb
                    if (preg_match("!/templates/\\w*\\.tpl!i", $file) && !$gBitSmarty->_is_compiled($file, $comppath)) {
                        $gBitSmarty->_compile_resource($file, $comppath);
                    }
                }
            }
        }
        closedir($dir);
    }
}
Exemplo n.º 9
0
	/**
	* Caches the generally required templates and the specifically requested templates.
	*
	* @param	string	Serialized array of template name => template id pairs
	*/
	protected function cache_templates($template_ids)
	{
		global $vbulletin, $show;

		$cache = is_array($this->cache_templates) ? $this->cache_templates : array();

		// Choose proper human verification template
		if ($vbulletin->options['hv_type'] AND in_array('humanverify', $cache))
		{
			$cache[] = 'humanverify_' . strtolower($vbulletin->options['hv_type']);
		}

		// templates to be included in every single page...
		$cache = array_merge($cache, array(
			// the really important ones
			'header',
			'footer',
			'headinclude',
			'headinclude_bottom',
			// ad location templates
			'ad_header_logo',
			'ad_header_end',
			'ad_navbar_below',
			'ad_footer_start',
			'ad_footer_end',
			'ad_global_header1',
			'ad_global_header2',
			'ad_global_below_navbar',
			'ad_global_above_footer',
			// new private message script
			'pm_popup_script',
			'memberaction_dropdown',
			// navbar construction
			'navbar',
			'navbar_link',
			'navbar_noticebit',
			'navbar_notifications_menubit',
			// forumjump and go button
			'forumjump',
			'forumjump_link',
			'forumjump_subforum',
			'gobutton',
			'option',
			// multi-page navigation
			'pagenav',
			'pagenav_curpage',
			'pagenav_pagelink',
			'pagenav_pagelinkrel',
			'threadbit_pagelink',
			// misc useful
			'spacer_open',
			'spacer_close',
			'STANDARD_ERROR',
			'STANDARD_REDIRECT',
			//'board_inactive_warning'
			// facebook templates
			'facebook_header',
			'facebook_footer',
			'facebook_opengraph'
		));

		// if we are in a message editing page then get the editor templates
		$show['editor_css'] = false;
		if (defined('GET_EDIT_TEMPLATES'))
		{
			$_get_edit_templates = explode(',', GET_EDIT_TEMPLATES);
			if (GET_EDIT_TEMPLATES === true OR in_array($_REQUEST['do'], $_get_edit_templates))
			{
				$cache = array_merge($cache, array(
					// message stuff 3.5
					'editor_toolbar_on',
					'editor_smilie',
					// message area for wysiwyg / non wysiwyg
					'editor_clientscript',
					'editor_toolbar_off',
					'editor_smilie_category',
					'editor_smilie_row',
					'editor_toolbar_fontname',
					'editor_toolbar_fontsize',
					'editor_toolbar_colors',
					// javascript menu builders
					'editor_jsoptions_font',
					'editor_jsoptions_size',
					// smiliebox templates
					'editor_smiliebox',
					// needed for thread preview
					'bbcode_code',
					'bbcode_html',
					'bbcode_php',
					'bbcode_quote',
					'bbcode_video',
					// misc often used
					'newpost_threadmanage',
					'newpost_disablesmiliesoption',
					'newpost_preview',
					'newpost_quote',
					'posticonbit',
					'posticons',
					'newpost_usernamecode',
					'newpost_errormessage',
					'forumrules'
				));

				$show['editor_css'] = true;
			}
		}

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

		cache_templates($cache, $template_ids);
	}
Exemplo n.º 10
0
 /**
  * Caches the generally required templates and the specifically requested templates.
  *
  * @param	string	Serialized array of template name => template id pairs
  */
 protected function cache_templates($template_ids)
 {
     global $vbulletin, $show;
     $cache = is_array($this->cache_templates) ? $this->cache_templates : array();
     $this->group_templates = is_array($this->group_templates) ? $this->group_templates : array();
     // Choose proper human verification template
     if ($vbulletin->options['hv_type'] and in_array('humanverify', $cache)) {
         $cache[] = 'humanverify_' . strtolower($vbulletin->options['hv_type']);
     }
     // templates to be included in every single page...
     $cache = array_merge($cache, array('header', 'footer', 'headinclude', 'headinclude_bottom', 'ad_header_logo', 'ad_header_end', 'ad_navbar_below', 'ad_footer_start', 'ad_footer_end', 'ad_global_header1', 'ad_global_header2', 'ad_global_below_navbar', 'ad_global_above_footer', 'ad_showthread_firstpost_sig', 'ad_showthread_firstpost_start', 'ad_thread_first_post_content', 'pm_popup_script', 'memberaction_dropdown', 'navbar', 'navbar_tabs', 'navbar_link', 'navbar_noticebit', 'navbar_notifications_menubit', 'forumjump', 'forumjump_link', 'forumjump_subforum', 'gobutton', 'option', 'pagenav', 'pagenav_curpage', 'pagenav_pagelink', 'pagenav_pagelinkrel', 'threadbit_pagelink', 'spacer_open', 'spacer_close', 'STANDARD_ERROR', 'STANDARD_REDIRECT', 'facebook_header', 'facebook_footer', 'facebook_opengraph'));
     // if we are in a message editing page then get the editor templates
     $show['editor_css'] = false;
     if (defined('GET_EDIT_TEMPLATES')) {
         $_get_edit_templates = explode(',', GET_EDIT_TEMPLATES);
         if (GET_EDIT_TEMPLATES === true or in_array($_REQUEST['do'], $_get_edit_templates)) {
             $cache = array_merge($cache, array('editor_ckeditor', 'editor_smilie', 'editor_clientscript', 'editor_smilie_category', 'editor_smilie_row', 'editor_jsoptions_font', 'editor_jsoptions_size', 'editor_smiliebox', 'bbcode_code', 'bbcode_html', 'bbcode_php', 'bbcode_quote', 'bbcode_video', 'newpost_threadmanage', 'newpost_disablesmiliesoption', 'newpost_preview', 'newpost_quote', 'posticonbit', 'posticons', 'newpost_usernamecode', 'newpost_errormessage', 'newpost_attachment', 'newpost_attachmentbit', 'forumrules'));
             $show['editor_css'] = true;
         }
     }
     ($hook = vBulletinHook::fetch_hook('cache_templates')) ? eval($hook) : false;
     if ($this->group_templates) {
         $wherelist = '';
         $cachelist = array_unique($this->group_templates);
         foreach ($cachelist as $group) {
             list($name, $type) = explode('.', $group);
             $wherelist .= $wherelist ? ' OR ' : 'WHERE ';
             if ($type) {
                 if ($name == 'class') {
                     // Whole class e.g. class.vbblog
                     $wherelist .= "title LIKE '{$type}_%'";
                 } else {
                     // Group list e.g. vbcms.grid
                     $wherelist .= "title LIKE '{$name}_%{$type}%'";
                 }
             } else {
                 // Single template
                 $wherelist .= "title = '{$name}'";
             }
         }
         $grouplist = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT title\n\t\t\t\tFROM " . TABLE_PREFIX . "template\n\t\t\t\t{$wherelist}\n\t\t\t");
         while ($data = $vbulletin->db->fetch_array($grouplist)) {
             $cache[] = $data['title'];
         }
     }
     cache_templates($cache, $template_ids);
 }