Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Infernus
1
Archived fixes / Unable to click/hover on menus
« on June 2nd, 2014, 05:59 PM »
If you click to many times on menus, they seem to freeze and dont accept any further actions until page is reloaded. Hovering doesn't work either. Using latest chrome.

Possible css bug?

2
Archived fixes / Possible js bug in admin panel
« on June 2nd, 2014, 05:49 PM »
Dont know if it's a bug, but it seems to appear in admin panel by using any browser. Affects javascript.

Browsers
Chrome:
(click to show/hide)
Code: [Select]
Uncaught SyntaxError: Unexpected token ILLEGAL index.php?action=admin:254
Code: [Select]
Google Chrome 35.0.1916.114 (Official build 270117) m
ОС Windows
Blink 537.36 (@173968)
JavaScript V8 3.25.28.16
Flash 13.0.0.214
User Agent Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36

Firefox:
(click to show/hide)
Code: [Select]
SyntaxError: unterminated string literal index.php:391
Code: [Select]
Mozilla firefox 29.0.1
ОС Windows
Mozilla/5.0 (Windows NT 5.1; rv:29.0) Gecko/20100101 Firefox/29.0

Opera:
(click to show/hide)
Code: [Select]
Uncaught SyntaxError: Unexpected token ILLEGAL index.php?action=admin:254
Code: [Select]
21.0.1432.67 - Opera
Stable
OC: Windows XP 32-bit
Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.132 Safari/537.36 OPR/21.0.1432.67


PHP Source:
(click to show/hide)
/app/Admin.php
Code: [Select]
// This sets the announcements and current versions themselves ;)
add_js('
new we_AdminIndex({
bLoadAnnouncements: true,
sAnnouncementTemplate: ', JavaScriptEscape('
<dl>
%content%
</dl>
'), ',
sAnnouncementMessageTemplate: ', JavaScriptEscape('
<dt><a href="%href%">%subject%</a> ' . sprintf($txt['on_date'], '%time%') . '</dt>
<dd>
%message%
</dd>
'), ',
sAnnouncementContainerId: \'wedge_news\',
sMonths: [\'', implode('\', \'', $txt['months']), '\'],
sMonthsShort: [\'', implode('\', \'', $txt['months_short']), '\'],
sDays: [\'', implode('\', \'', $txt['days']), '\'],
sDaysShort: [\'', implode('\', \'', $txt['days_short']), '\'],

bLoadVersions: true,
sVersionOutdatedTemplate: ' . JavaScriptEscape('
<span class="alert">%currentVersion%</span>
') . ',

bLoadUpdateNotification: true,
sUpdateTitle: ' . JavaScriptEscape($txt['update_available']) . ',
sUpdateMessage: ' . JavaScriptEscape($txt['update_message']) . ',
sUpdateLink: we_script + \'?action=admin;area=packages;pgdownload;auto;package=%package%;' . $context['session_query'] . '\'
});');

/app/Subs-Cache.php
Code: [Select]
/**
 * This function adds a string to the footer JavaScript that relies on jQuery and script.js being loaded.
 * Several strings can be passed as parameters, allowing for easier conversion from an "echo" to an "add_js()" call.
 */
function add_js()
{
global $context, $footer_coding;

if (empty($footer_coding))
{
$footer_coding = true;
$context['footer_js'] .= '
<script>';
}
$args = func_get_args();
$context['footer_js'] .= implode('', $args);
}

/app/Subs.php
Code: [Select]
/**
 * Sanitizes strings that might be passed through to JavaScript.
 *
 * Multiple instances of scripts will need to be adjusted through the codebase if passed to JavaScript through the template. This function will handle quoting of the string's contents, including providing the encapsulating quotes (so no need to echo '"', JavaScriptEscape($var), '"'; but simply echo JavaScriptEscape($var); instead.)
 *
 * Other protections include dealing with newlines, carriage returns (through suppression), single quotes, links, inline script tags, and SCRIPT. (Probably to prevent search bots from indexing JS-only URLs.)
 *
 * @param string $string A string whose contents to be quoted.
 * @param string $q (for quote) The quote character to use around the string. Defaults to '. Can be useful to switch to " if called within a string already declared with single quotes.
 * @return string A transformed string with contents suitably quoted for use in JavaScript.
 */
function JavaScriptEscape($string, $q = "'")
{
$xq = $q == '"' ? "\x0f" : "\x10";
return $xq . str_replace(
array('\\',   "\n",   'script',   'href=',   '"' . SCRIPT,         "'" . SCRIPT,         $q == '"' ? "'" : '"',       $q),
array('\\\\', "\\\n", 'scr\\ipt', 'hr\\ef=', '"' . SCRIPT . '"+"', "'" . SCRIPT . "'+'", $q == '"' ? "\x10" : "\x0f", '\\' . $xq),
$string
) . $xq;
}

Live source (code preview in browser):
(click to show/hide)
Code: [Select]
<script>
new we_AdminIndex({
bLoadAnnouncements: true,
sAnnouncementTemplate: '
\
<dl>
\
%content%
\
</dl>
\
',
sAnnouncementMessageTemplate: '
\
<dt><a hr\ef="%href%">%subject%</a> on %time%</dt>
\
<dd>
\
%message%
\
</dd>
\
',
sAnnouncementContainerId: 'wedge_news',
sMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
sMonthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
sDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
sDaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],

bLoadVersions: true,
sVersionOutdatedTemplate: '
\
<span class="alert">%currentVersion%</span>
\
',

bLoadUpdateNotification: true,
sUpdateTitle: 'Update Available!',
sUpdateMessage: 'You\'re using an outdated version of Wedge, which contains some bugs which have since been fixed.
\
It is recommended that you <a hr\ef="#" id="update-link">update your forum</a> to the latest version as soon as possible. It only takes a minute!',
sUpdateLink: we_script + '?action=admin;area=packages;pgdownload;auto;package=%package%;ca509c0=59cd8d0732ce33c0d7372308ebeed895'
});
new JumpTo("jump_to");
</script>