View Single Post
  #564  
Old 05-20-2009, 11:06 AM
stardotstar stardotstar is offline
 
Join Date: May 2008
Location: SYD, AU
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK I think I can see where this is happening but just don't know how to track it down - it is possible that this is specific to 3.8.2 and I would be very willing to write up my method for getting it to work if I can get this time issue sorted.

The Time skew occurs if and only if there is a local mode invocation called using the <ad /> code.

I can put

<ad what="zone:1" /> in the footer or header, refer to it from an ad location or whatever but so long as there is a reference to this tag the time jumps back 10 hours.

So when I look at the plugin called
Ad tag callback
I see that its hook is at the template_compile and this tells me that it is a likely cause of elements of the time being rewritten...

Interestingly the time statement at the bottom of the board is always correctly displayed and if I switch the time mode to "detailed" I get the correct time (ie 1 minute ago) for a post just made instead of a 10 hour shift into the past... BUT in the PM inbox the time shift is still evident.

This is the plugin code:

Code:
if (!function_exists('_tag_callback'))
{
	/**
	* Callback-function for process_template_tag() which "parses" arguments and returns PHP code for eval
	*
	* @param	string	Options/arguments of tag
	* @param	string	Name of function to call
	* @param	array	Associative array of argument names and default values
	*
	* @return	string
	*/
	function _tag_callback($options, $functionhandle, $arglist)
	{
		$options = stripslashes($options);
		trim($options);
		trim($functionhandle);

		if (!function_exists('replace_template_variables'))
		{
			require_once(DIR . '/includes/functions_misc.php');
		}

		$param = array();
		if (is_array($arglist))
		{
			reset($arglist);
			foreach ($arglist AS $key => $val)
			{
				if (preg_match('#'.$key.'=([\\\]["\'])(.*?)\1#', $options, $matches))
				{
					$param[] = $matches[2];
				}
				else
				{
					// default argument
					$param[] = $val;
				}
			}
		}
		
		foreach ($param AS $argument)
		{
			if ($return == '')
			{
				$return = '" . ' . $functionhandle . '(';
			}
			else
			{
				$return .= ', ';
			}
			// Surround variables with {} - not failsafe, but should do the job in most cases 
			$argument = preg_replace('#\$([a-z0-9_>-]+)((\[\'.*?\'\])+)#i', '{$\\1\\2}', $argument);
			// {{$foo}} --> {$foo}
			$argument = preg_replace('#(\{+)\$(.*?)(\}+)#i', '{$\\2}', $argument);

			// Replace legacy variable names in templates with their modern equivalents
			$argument = replace_template_variables($argument, true);

			$return .= '"' . $argument . '"';
		}
		$return .= ') . "';
		return $return;
	}
}

if (!function_exists('process_template_tag'))
{
	/**
	* Processes user-defined tags <tagname [argument="foo" ...]/> into myfunction() PHP code for eval
	*
	* @param	string	Title of tag
	* @param	string	Un-parsed template HTML
	* @param	string	Name of function to call
	* @param	array	Associative array of argument names and default values, order must be the same as for the function specified previously
	*
	* @return	string
	*/
	function process_template_tag($tagname, $text, $functionhandle='', $arglist)
	{
		if ($functionhandle == '')
		{
			// No function specified - remove tag
			return preg_replace("#<{$tagname}\s?/?>|<{$tagname}\s.*?/?>#si", '', $text);
		}
		else
		{
			return preg_replace("#<({$tagname})(\s+(.*?)/?)>#sie", "_tag_callback('\\3', \$functionhandle, \$arglist)", $text);
		}
	}
}

$template = process_template_tag('ad', $template, 'view_ad', array('what' => '', 'clientid' => 0, 'target' => '', 'source' => '', 'withtext' => 0)  );
can anyone see anything that might cause the effect on time display in postbit and elsewhere in the templates?

Does anyone think I am on the right track or is it futile troubleshooting this wonderful but rather antiquated (for 3.5) implementation now?>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01073 seconds
  • Memory Usage 1,783KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete