• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
    • Wiki
    • Support
      • Manage Subscriptions
      • FAQ
      • Support For
        • VaultWiki 4.x Series
        • VaultWiki.org Site
    • What's New?
    • Buy Now
    • Manual
    • 
    • Support
    • VaultWiki 3.x Series
    • Bug
    • bug in templates with if exist check on image (or even text with imagelink)

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Issue: bug in templates with if exist check on image (or even text with imagelink)

    • Issue Tools
      • View Changes
    1. issueid=2508 October 18, 2011 8:08 AM
      Lord Doys Lord Doys is offline
      Junior Member
      bug in templates with if exist check on image (or even text with imagelink)

      I found a strange bug while dealing with an IF statement to check if a image is given.

      in the first template i check on every item:
      [if="{{{title|}}}"]{{{title}}}[/if]
      [if="{{{image|}}}"]{{{image}}}[/if]
      [if="{{{textimage|}}}"]{{{textimage}}}[/if]
      [if="{{{below|}}}"]{{{below}}}[/if]

      title and below are displayed, image is not. even the text with image is not displayed

      in the seccond template, i just display them without checking:
      {{{title}}}
      {{{image}}}
      {{{textimage}}}
      {{{below}}}

      see:
      https://www.vaultwiki.org/demo/TestArjan

      also the aligning is strange.
      in {{{textimage}}}, i write the text first THEN the image, but it displays the image first, then the text
    Issue Details
    Issue Number 2508
    Issue Type Bug
    Project VaultWiki 3.x Series
    Category Templates
    Status Fixed
    Priority 3 - Loss of Functionality
    Affected Version 3.0.14
    Fixed Version 3.0.15
    Milestone (none)
    Software DependencyAny
    Users able to reproduce bug 0
    Users unable to reproduce bug 0
    Attachments 0
    Assigned Users (none)
    Tags (none)




    1. October 18, 2011 5:04 PM
      pegasus pegasus is offline
      VaultWiki Team
      Intriguing... Okay the problem here is that IF interprets | in the option value as a delimiter that means left-side == right-side, as in MediaWiki with #ifeq, and at the same time we have passed in a parameter that when evaluated also contains |.

      We can make the following changes, which should make IF ignore | (or any other comparative delimiter, for that matter) if it was included by a template parameter. It seems to have worked in the reproduction you posted here.

      In vault/class/bbcode/template.php, find:
      Code:
      				$text = str_replace($param['find'], $value, $text);
      Replace with:
      Code:
      				$text = str_replace($param['find'], '<!-- was param -->' . $value . '<!-- / was param -->', $text);
      In vault/class/bbcode/extension.php, find:
      Code:
      			$condmatch = preg_split('#(\||==|!=|<>|>=|<=|>|<)#', $cond, 3, PREG_SPLIT_DELIM_CAPTURE);
      
      			if (count($condmatch) == 3)
      			{
      Replace with:
      Code:
      			$condmatch = preg_split('#(?:<\!-- / was param -->)?\s*(\||==|!=|<>|>=|<=|>|<)#', $cond, 3, PREG_SPLIT_DELIM_CAPTURE);
      
      			if (count($condmatch) == 3)
      			{
      				foreach ($condmatch AS $key => $match)
      				{
      					$condmatch["$key"] = str_replace(array(
      						'<!-- was param -->',
      						'<!-- / was param -->'
      					), '', $match);
      				}
      Reply Reply  
    2. This petition for a change to Awaiting Feedback was rejected
      October 19, 2011 3:50 AM
      Lord Doys Lord Doys is offline
      Junior Member
      I have adjusted the files, but it didnt seem to be working.
      I was playing arround with the template and suddenly i had an image..

      looking at the difference i noticed that once i put a parameter to the image.. then it stops working
      Code:
      [image]picture.png|left[/image]
      [image]picture.png|right[/image]
      [image]picture.png|center[/image]
      [image]picture.png|100px[/image]
      [image]picture.png|thumb[/image]
      all dont work..


      so only:
      Code:
      [image]picture.png[/image]
      works
       
    3. October 19, 2011 6:48 AM
      pegasus pegasus is offline
      VaultWiki Team
      This is exactly what I was talking about in the previous post, but it's not about the parameter specifically, it's about the | that separates the parameter.

      The change I posted fixes the issue here so I don't know what else to do for you. Keep in mind that the change is probably not immediate because the incorrect version is saved in your forum's post cache. You can always view an uncached version of an article by adding &redirect=no to the URL.

      If you can reproduce the issue again here I will look at it again.
      Reply Reply  
    4. October 19, 2011 7:35 AM
      Lord Doys Lord Doys is offline
      Junior Member
      cant reproduce, cant fix, no clue...
      Reply Reply  
    5. October 19, 2011 9:22 AM
      Lord Doys Lord Doys is offline
      Junior Member
      I have found the cause of it, and i am able to reproduce and fix it.

      its all about the admin setting: Enable support for Legacy Wiki Markup?
      if you put this on disable, then everything works as intended.

      When put on "MediaWiki" (like i had/have) then things stop working
      Reply Reply  
    6. October 19, 2011 9:41 AM
      Lord Doys Lord Doys is offline
      Junior Member
      the fixes a described do cause some other problems in other templates.

      I have updated https://www.vaultwiki.org/demo/TestArjan?redirect=no to reproduce
      there you see the result of another template :  view •  d • e 

      it should (and IS when i turn on legacy): view • d • e
      and, the links were working before.. now they have turned red with an endless long line of "was param"
      Code:
      <a id="autolink__13771_1" class="vw-link new" href="https://www.vaultwiki.org/pages/Template:was-param-name-was-param" title="Template:&lt;!-- was param --&gt;{{{name}}}&lt;!-- / was param --&gt; (not yet written)" rel="nofollow"><span title="View" class="vw-span">view</span></a>
      Reply Reply  
    7. October 19, 2011 3:44 PM
      pegasus pegasus is offline
      VaultWiki Team
      Fixed the links. In vault/class/bbcode/template.php, find:
      Code:
      	$text = str_replace($match[0], "[noedit]" . $template_text . "[/noedit]", $text);
      Add before:
      Code:
      			$text = str_replace(array(
      				'<!-- was param -->',
      				'<!-- / was param -->'
      			), '', $text);
      The &amp;nbsp; issue is actually expected when legacy is turned off, since vBulletin doesn't have very good HTML-entity support when HTML is turned off. The only thing I can think to do is replace &amp;nbsp; with empty span tags during a conversion, but this can get messy fast. In the case that you have, you should add a padding property to the span rather than the spaces.

      I am looking at the other issue now.
      Reply Reply  
    + Reply

    Assigned Users
    Loading Please Wait
    Tags
    Loading Please Wait
    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 1:57 AM.
    This site uses cookies to help personalize content, to tailor your experience, and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2023 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2023 DragonByte Technologies Ltd.
    Copyright © 2008 - 2013 VaultWiki Team, Cracked Egg Studios, LLC.