Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smf remnants #611

Merged
merged 16 commits into from Jul 5, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions install/upgrade.php
Expand Up @@ -3451,8 +3451,8 @@ function template_upgrade_above()
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/css/install.css?alp21" />
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js"></script>
<script type="text/javascript"><!-- // --><![CDATA[
var smf_scripturl = \'', $upgradeurl, '\';
var smf_charset = \'UTF-8\';
var elk_scripturl = \'', $upgradeurl, '\';
var elk_charset = \'UTF-8\';
var startPercent = ', $upcontext['overall_percent'], ';

// This function dynamically updates the step progress bar - and overall one as required.
Expand Down
28 changes: 14 additions & 14 deletions sources/Load.php
Expand Up @@ -1557,17 +1557,17 @@ function loadTheme($id_theme = 0, $initialize = true)

// Default JS variables for use in every theme
$context['javascript_vars'] = array(
'smf_theme_url' => '"' . $settings['theme_url'] . '"',
'smf_default_theme_url' => '"' . $settings['default_theme_url'] . '"',
'smf_images_url' => '"' . $settings['images_url'] . '"',
'smf_smiley_url' => '"' . $modSettings['smileys_url'] . '"',
'smf_scripturl' => '"' . $scripturl . '"',
'smf_default_theme_url' => '"' . $settings['default_theme_url'] . '"',
'smf_iso_case_folding' => $context['server']['iso_case_folding'] ? 'true' : 'false',
'smf_charset' => '"UTF-8"',
'smf_session_id' => '"' . $context['session_id'] . '"',
'smf_session_var' => '"' . $context['session_var'] . '"',
'smf_member_id' => $context['user']['id'],
'elk_theme_url' => '"' . $settings['theme_url'] . '"',
'elk_default_theme_url' => '"' . $settings['default_theme_url'] . '"',
'elk_images_url' => '"' . $settings['images_url'] . '"',
'elk_smiley_url' => '"' . $modSettings['smileys_url'] . '"',
'elk_scripturl' => '"' . $scripturl . '"',
'elk_default_theme_url' => '"' . $settings['default_theme_url'] . '"',
'elk_iso_case_folding' => $context['server']['iso_case_folding'] ? 'true' : 'false',
'elk_charset' => '"UTF-8"',
'elk_session_id' => '"' . $context['session_id'] . '"',
'elk_session_var' => '"' . $context['session_var'] . '"',
'elk_member_id' => $context['user']['id'],
'ajax_notification_text' => JavaScriptEscape($txt['ajax_in_progress']),
'ajax_notification_cancel_text' => JavaScriptEscape($txt['modify_cancel']),
'help_popup_heading_text' => JavaScriptEscape($txt['help_popup']),
Expand Down Expand Up @@ -1597,12 +1597,12 @@ function loadTheme($id_theme = 0, $initialize = true)
$ts = $type == 'mailq' ? $modSettings['mail_next_send'] : $modSettings['next_task_time'];

addInlineJavascript('
function smfAutoTask()
function elkAutoTask()
{
var tempImage = new Image();
tempImage.src = smf_scripturl + "?scheduled=' . $type . ';ts=' . $ts . '";
tempImage.src = elk_scripturl + "?scheduled=' . $type . ';ts=' . $ts . '";
}
window.setTimeout("smfAutoTask();", 1);');
window.setTimeout("elkAutoTask();", 1);');
}
}

Expand Down
2 changes: 1 addition & 1 deletion sources/QueryString.php
Expand Up @@ -333,7 +333,7 @@ function JavaScriptEscape($string)
'<script' => '<scri\'+\'pt',
'<body>' => '<bo\'+\'dy>',
'<a href' => '<a hr\'+\'ef',
$scripturl => '\' + smf_scripturl + \'',
$scripturl => '\' + elk_scripturl + \'',
)) . '\'';
}

Expand Down
2 changes: 1 addition & 1 deletion sources/Session.php
Expand Up @@ -56,7 +56,7 @@ function loadSession()
// This is here to stop people from using bad junky PHPSESSIDs.
if (isset($_REQUEST[session_name()]) && preg_match('~^[A-Za-z0-9,-]{16,64}$~', $_REQUEST[session_name()]) == 0 && !isset($_COOKIE[session_name()]))
{
$session_id = md5(md5('smf_sess_' . time()) . mt_rand());
$session_id = md5(md5('elk_sess_' . time()) . mt_rand());
$_REQUEST[session_name()] = $session_id;
$_GET[session_name()] = $session_id;
$_POST[session_name()] = $session_id;
Expand Down
18 changes: 9 additions & 9 deletions sources/Subs.php
Expand Up @@ -1154,7 +1154,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
array(
'tag' => 'code',
'type' => 'unparsed_content',
'content' => '<div class="codeheader">' . $txt['code'] . ': <a href="javascript:void(0);" onclick="return smfSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><pre class="bbc_code">$1</pre>',
'content' => '<div class="codeheader">' . $txt['code'] . ': <a href="javascript:void(0);" onclick="return elkSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><pre class="bbc_code">$1</pre>',
// @todo Maybe this can be simplified?
'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
global $context;
Expand Down Expand Up @@ -1191,7 +1191,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
array(
'tag' => 'code',
'type' => 'unparsed_equals_content',
'content' => '<div class="codeheader">' . $txt['code'] . ': ($2) <a href="#" onclick="return smfSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><pre class="bbc_code">$1</pre>',
'content' => '<div class="codeheader">' . $txt['code'] . ': ($2) <a href="#" onclick="return elkSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><pre class="bbc_code">$1</pre>',
// @todo Maybe this can be simplified?
'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
global $context;
Expand Down Expand Up @@ -2749,7 +2749,7 @@ function obExit($header = null, $do_footer = null, $from_index = false, $from_fa
ob_clean();

echo strtr($temp, array(
'var smf_iso_case_folding' => 'var target_blank = \'_blank\'; var smf_iso_case_folding',
'var elk_iso_case_folding' => 'var target_blank = \'_blank\'; var elk_iso_case_folding',
'target="_blank"' => 'onclick="this.target=target_blank"'));
}

Expand Down Expand Up @@ -2916,7 +2916,7 @@ function setupThemeContext($forceload = false)
new smc_Popup({
heading: ' . JavaScriptEscape($txt['show_personal_messages_heading']) . ',
content: ' . JavaScriptEscape(sprintf($txt['show_personal_messages'], $context['user']['unread_messages'], $scripturl . '?action=pm')) . ',
icon: smf_images_url + \'/im_sm_newmsg.png\'
icon: elk_images_url + \'/im_sm_newmsg.png\'
});
});');

Expand All @@ -2925,11 +2925,11 @@ function setupThemeContext($forceload = false)
{
// @todo Move this over to script.js?
addInlineJavascript('
var smf_avatarMaxWidth = ' . (int) $modSettings['avatar_max_width_external'] . ';
var smf_avatarMaxHeight = ' . (int) $modSettings['avatar_max_height_external'] . ';' . (!isBrowser('ie') ? '
window.addEventListener("load", smf_avatarResize, false);' : '
var elk_avatarMaxWidth = ' . (int) $modSettings['avatar_max_width_external'] . ';
var elk_avatarMaxHeight = ' . (int) $modSettings['avatar_max_height_external'] . ';' . (!isBrowser('ie') ? '
window.addEventListener("load", elk_avatarResize, false);' : '
var window_oldAvatarOnload = window.onload;
window.onload = smf_avatarResize;'));
window.onload = elk_avatarResize;'));
}

// This looks weird, but it's because BoardIndex.controller.php references the variable.
Expand All @@ -2948,7 +2948,7 @@ function setupThemeContext($forceload = false)
$context['common_stats']['boardindex_total_posts'] = sprintf($txt['boardindex_total_posts'], $context['common_stats']['total_posts'], $context['common_stats']['total_topics'], $context['common_stats']['total_members']);

if (empty($settings['theme_version']))
addJavascriptVar('smf_scripturl', $scripturl);
addJavascriptVar('elk_scripturl', $scripturl);

if (!isset($context['page_title']))
$context['page_title'] = '';
Expand Down
6 changes: 3 additions & 3 deletions sources/admin/AdminDebug.php
Expand Up @@ -227,9 +227,9 @@ public function action_viewadminfile()
// Figure out if sesc is still being used.
if (strpos($file['file_data'], ';sesc=') !== false)
$file['file_data'] = '
if (!(\'smfForum_sessionvar\' in window))
window.smfForum_sessionvar = \'sesc\';
' . strtr($file['file_data'], array(';sesc=' => ';\' + window.smfForum_sessionvar + \'='));
if (!(\'elkForum_sessionvar\' in window))
window.elkForum_sessionvar = \'sesc\';
' . strtr($file['file_data'], array(';sesc=' => ';\' + window.elkForum_sessionvar + \'='));

Template_Layers::getInstance()->removeAll();

Expand Down
4 changes: 2 additions & 2 deletions sources/admin/Themes.php
Expand Up @@ -1154,9 +1154,9 @@ public function action_install()

// Lets add a theme_info.xml to this theme.
$xml_info = '<' . '?xml version="1.0"?' . '>
<theme-info xmlns="http://www.simplemachines.org/xml/theme-info" xmlns:smf="http://www.simplemachines.org/">
<theme-info xmlns="http://www.simplemachines.org/xml/theme-info" xmlns:elk="http://www.simplemachines.org/">
<!-- For the id, always use something unique - put your name, a colon, and then the package name. -->
<id>smf:' . Util::strtolower(str_replace(array(' '), '_', $_REQUEST['copy'])) . '</id>
<id>elk:' . Util::strtolower(str_replace(array(' '), '_', $_REQUEST['copy'])) . '</id>
<version>' . $modSettings['elkVersion'] . '</version>
<!-- Theme name, used purely for aesthetics. -->
<name>' . $_REQUEST['copy'] . '</name>
Expand Down
14 changes: 7 additions & 7 deletions sources/subs/Editor.subs.php
Expand Up @@ -178,7 +178,7 @@ function create_control_richedit($editorOptions)
// JS makes the editor go round
loadJavascriptFile(array('jquery.sceditor.js', 'jquery.sceditor.bbcode.js', 'jquery.sceditor.elkarte.js', 'post.js'));
addInlineJavascript('
var smf_smileys_url = \'' . $settings['smileys_url'] . '\';
var elk_smileys_url = \'' . $settings['smileys_url'] . '\';
var bbc_quote_from = \'' . addcslashes($txt['quote_from'], "'") . '\';
var bbc_quote = \'' . addcslashes($txt['quote'], "'") . '\';
var bbc_search_on = \'' . addcslashes($txt['search_on'], "'") . '\';');
Expand Down Expand Up @@ -880,7 +880,7 @@ public function showVerification($isNew, $force_refresh = true)
$this->_image_href = $scripturl . '?action=verificationcode;vid=' . $this->_options['id'] . ';rand=' . md5(mt_rand());

addInlineJavascript('
var verification' . $this->_options['id'] . 'Handle = new smfCaptcha("' . $this->_image_href . '", "' . $this->_options['id'] . '", ' . ($this->_use_graphic_library ? 1 : 0) . ');', true);
var verification' . $this->_options['id'] . 'Handle = new elkCaptcha("' . $this->_image_href . '", "' . $this->_options['id'] . '", ' . ($this->_use_graphic_library ? 1 : 0) . ');', true);
}

if ($isNew || $force_refresh)
Expand Down Expand Up @@ -1434,7 +1434,7 @@ function html_to_bbc($text)
// Remove any formatting within code tags.
if (strpos($text, '[code') !== false)
{
$text = preg_replace('~<br\s?/?' . '>~i', '#smf_br_spec_grudge_cool!#', $text);
$text = preg_replace('~<br\s?/?' . '>~i', '#elk_br_spec_grudge_cool!#', $text);
$parts = preg_split('~(\[/code\]|\[code(?:=[^\]]+)?\])~i', $text, -1, PREG_SPLIT_DELIM_CAPTURE);

// Only mess with stuff outside [code] tags.
Expand All @@ -1445,7 +1445,7 @@ function html_to_bbc($text)
$parts[$i] = strip_tags($parts[$i]);
}

$text = strtr(implode('', $parts), array('#smf_br_spec_grudge_cool!#' => '<br />'));
$text = strtr(implode('', $parts), array('#elk_br_spec_grudge_cool!#' => '<br />'));
}

// Remove scripts, style and comment blocks.
Expand All @@ -1469,7 +1469,7 @@ function html_to_bbc($text)
$found = array_search($file, $smileysto);
// Note the weirdness here is to stop double spaces between smileys.
if ($found)
$matches[1][$k] = '-[]-smf_smily_start#|#' . htmlspecialchars($smileysfrom[$found]) . '-[]-smf_smily_end#|#';
$matches[1][$k] = '-[]-elk_smily_start#|#' . htmlspecialchars($smileysfrom[$found]) . '-[]-elk_smily_end#|#';
else
$matches[1][$k] = '';
}
Expand Down Expand Up @@ -1499,15 +1499,15 @@ function html_to_bbc($text)

foreach ($matches[1] as $k => $file)
if (isset($mappings[$file]))
$matches[1][$k] = '-[]-smf_smily_start#|#' . $mappings[$file] . '-[]-smf_smily_end#|#';
$matches[1][$k] = '-[]-elk_smily_start#|#' . $mappings[$file] . '-[]-elk_smily_end#|#';
}
}

// Replace the tags!
$text = str_replace($matches[0], $matches[1], $text);

// Now sort out spaces
$text = str_replace(array('-[]-smf_smily_end#|#-[]-smf_smily_start#|#', '-[]-smf_smily_end#|#', '-[]-smf_smily_start#|#'), ' ', $text);
$text = str_replace(array('-[]-elk_smily_end#|#-[]-elk_smily_start#|#', '-[]-elk_smily_end#|#', '-[]-elk_smily_start#|#'), ' ', $text);
}

// Only try to buy more time if the client didn't quit.
Expand Down