From 7c3a6b3a4835820a81cc9dd640c2d4d2455aa625 Mon Sep 17 00:00:00 2001 From: Nao Date: Sun, 23 Mar 2014 16:21:49 +0100 Subject: [PATCH] * Replaced all $boarddir occurrences with ROOT_DIR. Replaced most $boardurl with ROOT. Getting close! (Class-Editor.php, Class-FileWritable.php, ManageErrors.php, ManagePlugins.php, ManageServer.php, QueryString.php, Subs-Admin.php, Subs-Plugins.php, Subs-Template.php, Themes.php, ViewQuery.php, Aeva-Foxy.php, Aeva-Gallery.php, ManageMedia.php) --- core/app/Class-Editor.php | 14 ++++++------ core/app/Class-FileWritable.php | 3 +-- core/app/ManageErrors.php | 4 ++-- core/app/ManagePlugins.php | 4 ++-- core/app/ManageServer.php | 6 +++--- core/app/QueryString.php | 6 +++--- core/app/Subs-Admin.php | 30 +++++++++++--------------- core/app/Subs-Plugins.php | 6 +++--- core/app/Subs-Template.php | 14 ++++++------ core/app/Themes.php | 38 ++++++++++++++++----------------- core/app/ViewQuery.php | 4 ++-- core/app/media/Aeva-Foxy.php | 8 +++---- core/app/media/Aeva-Gallery.php | 4 ++-- core/app/media/ManageMedia.php | 5 +---- 14 files changed, 67 insertions(+), 79 deletions(-) diff --git a/core/app/Class-Editor.php b/core/app/Class-Editor.php index b5ae62cc..a39552e7 100644 --- a/core/app/Class-Editor.php +++ b/core/app/Class-Editor.php @@ -2148,12 +2148,10 @@ public static function fixTags(&$message) // Fix a specific class of tag - ie. url with =. public static function fixTag(&$message, $myTag, $protocols, $embeddedUrl = false, $hasEqualSign = false, $hasExtra = false) { - global $boardurl; - - if (preg_match('~^([^:]+://[^/]+)~', $boardurl, $match) != 0) + if (preg_match('~^([^:]+://[^/]+)~', ROOT, $match) != 0) $domain_url = $match[1]; else - $domain_url = $boardurl . '/'; + $domain_url = ROOT . '/'; $replaces = array(); @@ -2439,7 +2437,7 @@ public static function preparseWYSIWYG($id) public function outputEditor() { - global $context, $txt, $settings, $boarddir, $boardurl, $smiley_css_done; + global $context, $txt, $settings, $smiley_css_done; $smileycontainer = empty($this->editorOptions['custom_smiley_div']) ? 'smileyBox_' . $this->id : $this->editorOptions['custom_smiley_div']; $bbccontainer = empty($this->editorOptions['custom_bbc_div']) ? 'bbcBox_' . $this->id : $this->editorOptions['custom_bbc_div']; @@ -2487,14 +2485,14 @@ public function outputEditor() updateSettings(array($var_name => time() % 1000)); $context['smiley_now'] = $settings[$var_name]; $filename = '/gz/css/smileys' . $extra . (we::$user['smiley_set'] == 'default' ? '' : '-' . we::$user['smiley_set']) . '-' . $context['smiley_now'] . $context['smiley_ext']; - $exists = file_exists($boarddir . $filename); + $exists = file_exists(ROOT_DIR . $filename); if (!$exists) parsesmileys($dummy); } - if (empty($smiley_css_done) && strpos($context['header'], $boardurl . $filename) === false) + if (empty($smiley_css_done) && strpos($context['header'], ROOT . $filename) === false) $context['header'] .= ' - '; + '; $js = ''; foreach ($this->smileys as $location => $smileyRows) diff --git a/core/app/Class-FileWritable.php b/core/app/Class-FileWritable.php index a3f1c617..5d48d692 100644 --- a/core/app/Class-FileWritable.php +++ b/core/app/Class-FileWritable.php @@ -19,11 +19,10 @@ class weFileWritable // This is essentially pure placeholder but it makes everything much more convenient later. public function __construct($server = null, $port = null, $user = null, $pass = null) { - global $boarddir; $this->connection = false; $this->error = false; $this->pasv = array(); - $this->path = $boarddir; + $this->path = ROOT_DIR; } public function connect($server = null, $port = null, $user = null, $pass = null) diff --git a/core/app/ManageErrors.php b/core/app/ManageErrors.php index c689dc11..12c609f9 100644 --- a/core/app/ManageErrors.php +++ b/core/app/ManageErrors.php @@ -633,7 +633,7 @@ function updateErrorCount($count = 0) function ViewFile() { - global $context, $txt, $boarddir, $cachedir; + global $context, $txt; loadTemplate('GenericPopup'); loadLanguage('Help'); @@ -646,7 +646,7 @@ function ViewFile() $basename = strtolower(basename($file)); // Make sure the file we are looking for is one they are allowed to look at - if (strrchr($basename, '.') != '.php' || $basename == 'settings.php' || $basename == 'settings_bak.php' || !strhas($file, array(realpath($boarddir), realpath(APP_DIR), realpath($cachedir . '/php'))) || !is_readable($file)) + if (strrchr($basename, '.') != '.php' || $basename == 'settings.php' || $basename == 'settings_bak.php' || !strhas($file, array(realpath(ROOT_DIR), realpath(APP_DIR), realpath(ROOT_DIR . '/gz/php'))) || !is_readable($file)) fatal_lang_error('error_bad_file', true, array(htmlspecialchars(base64_decode($_REQUEST['file'])))); // Get the min and max lines diff --git a/core/app/ManagePlugins.php b/core/app/ManagePlugins.php index a6565501..6aa4e1cc 100644 --- a/core/app/ManagePlugins.php +++ b/core/app/ManagePlugins.php @@ -1434,8 +1434,8 @@ function executePluginScript($type, $file) if (empty($file) || substr($file, -4) != '.php' || strpos($file, '$plugindir/') !== 0 || !file_exists($full_path)) fatal_lang_error('fatal_install_' . $type . '_missing', false, empty($file) ? $txt['not_applicable'] : htmlspecialchars($file)); - // This is just here as reference for what is available. - global $txt, $boarddir, $settings, $context; + // Make these available to plugins. + global $txt, $settings, $context; require($full_path); } } diff --git a/core/app/ManageServer.php b/core/app/ManageServer.php index 959150b6..2c871b0f 100644 --- a/core/app/ManageServer.php +++ b/core/app/ManageServer.php @@ -123,7 +123,7 @@ // This is the main pass through function, it creates tabs and the like. function ModifySettings() { - global $context, $txt, $boarddir; + global $context, $txt; // This is just to keep the database password more secure. isAllowedTo('admin_forum'); @@ -165,8 +165,8 @@ function ModifySettings() if ($_REQUEST['sa'] != 'phpinfo') { // Warn the user if the backup of Settings.php failed. - $context['settings_not_writable'] = !is_writable($boarddir . '/Settings.php'); - $settings_backup_fail = !@is_writable($boarddir . '/Settings_bak.php') || !@copy($boarddir . '/Settings.php', $boarddir . '/Settings_bak.php'); + $context['settings_not_writable'] = !is_writable(ROOT_DIR . '/Settings.php'); + $settings_backup_fail = !@is_writable(ROOT_DIR . '/Settings_bak.php') || !@copy(ROOT_DIR . '/Settings.php', ROOT_DIR . '/Settings_bak.php'); if ($context['settings_not_writable']) $context['settings_message'] = '

' . $txt['settings_not_writable'] . '


'; diff --git a/core/app/QueryString.php b/core/app/QueryString.php index 2c0f6cac..e2c86aad 100644 --- a/core/app/QueryString.php +++ b/core/app/QueryString.php @@ -16,7 +16,7 @@ */ function loadPaths() { - global $boardurl, $boarddir, $settings, $context; + global $boardurl, $settings, $context; // $scripturl is your board URL if you asked to remove index.php or the user visits for the first time // (in which case they'll get the annoying PHPSESSID stuff in their URL and we need index.php in them.) @@ -109,7 +109,7 @@ function loadPaths() */ function cleanRequest() { - global $board, $topic, $boarddir, $settings, $context, $action_list; + global $board, $topic, $settings, $context, $action_list; // These were deprecated years ago. Save some memory. unset($GLOBALS['HTTP_POST_VARS'], $GLOBALS['HTTP_POST_FILES']); @@ -311,7 +311,7 @@ function cleanRequest() if (preg_match($regex, $full_request, $filename)) { // There are probably faster ways to retrieve an 'existing' cached version. - $matches = glob($boarddir . '/' . $filename[1] . '*.' . $filename[2]); + $matches = glob(ROOT_DIR . '/' . $filename[1] . '*.' . $filename[2]); if (!empty($matches) && preg_match($regex, (string) reset($matches), $new_filename)) { header('HTTP/1.1 301 Moved Permanently'); diff --git a/core/app/Subs-Admin.php b/core/app/Subs-Admin.php index f8e03b2c..81fa4dce 100644 --- a/core/app/Subs-Admin.php +++ b/core/app/Subs-Admin.php @@ -140,8 +140,6 @@ function getServerVersions($checkFor) // Search through source, theme and language files to determine their version. function getFileVersions(&$versionOptions) { - global $boarddir; - // Default place to find the languages would be the default theme dir. $lang_dir = LANGUAGES_DIR; @@ -152,9 +150,9 @@ function getFileVersions(&$versionOptions) ); // Find the version in SSI.php's file header. - if (!empty($versionOptions['include_ssi']) && file_exists($boarddir . '/SSI.php')) + if (!empty($versionOptions['include_ssi']) && file_exists(ROOT_DIR . '/SSI.php')) { - $fp = fopen($boarddir . '/SSI.php', 'rb'); + $fp = fopen(ROOT_DIR . '/SSI.php', 'rb'); $header = fread($fp, 4096); fclose($fp); @@ -167,9 +165,9 @@ function getFileVersions(&$versionOptions) } // Do the paid subscriptions handler? - if (!empty($versionOptions['include_subscriptions']) && file_exists($boarddir . '/subscriptions.php')) + if (!empty($versionOptions['include_subscriptions']) && file_exists(ROOT_DIR . '/subscriptions.php')) { - $fp = fopen($boarddir . '/subscriptions.php', 'rb'); + $fp = fopen(ROOT_DIR . '/subscriptions.php', 'rb'); $header = fread($fp, 4096); fclose($fp); @@ -265,13 +263,11 @@ function getFileVersions(&$versionOptions) // Update the Settings.php file. function updateSettingsFile($config_vars) { - global $boarddir, $cachedir; - // When was Settings.php last changed? - $last_settings_change = filemtime($boarddir . '/Settings.php'); + $last_settings_change = filemtime(ROOT_DIR . '/Settings.php'); // Load the file. Break it up based on \r or \n, and then clean out extra characters. - $settingsArray = trim(file_get_contents($boarddir . '/Settings.php')); + $settingsArray = trim(file_get_contents(ROOT_DIR . '/Settings.php')); if (strpos($settingsArray, "\n") !== false) $settingsArray = explode("\n", $settingsArray); elseif (strpos($settingsArray, "\r") !== false) @@ -352,17 +348,15 @@ function updateSettingsFile($config_vars) // Check before you act: do a simple test in the cache folder. // Can we even write things on this filesystem? - if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/gz')) - $cachedir = $boarddir . '/gz'; - $test_fp = @fopen($cachedir . '/settings_update.tmp', 'w+'); + $test_fp = @fopen(ROOT_DIR . '/gz/settings_update.tmp', 'w+'); if ($test_fp) { fclose($test_fp); - $test_fp = @fopen($cachedir . '/settings_update.tmp', 'r+'); + $test_fp = @fopen(ROOT_DIR . '/gz/settings_update.tmp', 'r+'); $written_bytes = fwrite($test_fp, 'test'); fclose($test_fp); - @unlink($cachedir . '/settings_update.tmp'); + @unlink(ROOT_DIR . '/gz/settings_update.tmp'); if ($written_bytes !== strlen('test')) { @@ -373,18 +367,18 @@ function updateSettingsFile($config_vars) // Protect me from what I want! :P clearstatcache(); - if (filemtime($boarddir . '/Settings.php') === $last_settings_change) + if (filemtime(ROOT_DIR . '/Settings.php') === $last_settings_change) { // You asked for it... // Blank out the file - done to fix a oddity with some servers. - $fp = @fopen($boarddir . '/Settings.php', 'w'); + $fp = @fopen(ROOT_DIR . '/Settings.php', 'w'); // Is it even writable, though? if ($fp) { fclose($fp); - $fp = fopen($boarddir . '/Settings.php', 'r+'); + $fp = fopen(ROOT_DIR . '/Settings.php', 'r+'); foreach ($settingsArray as $line) fwrite($fp, strtr($line, "\r", '')); fclose($fp); diff --git a/core/app/Subs-Plugins.php b/core/app/Subs-Plugins.php index d3377973..a328c9a8 100644 --- a/core/app/Subs-Plugins.php +++ b/core/app/Subs-Plugins.php @@ -12,7 +12,7 @@ function getWritableObject() { - global $context, $settings, $boarddir; + global $context, $settings; // Normally it'll be on the plugins folder, but there's no reason for it to absolutely be. // !! Is $path supposed to be set earlier..? @@ -66,12 +66,12 @@ function getWritableObject() if (!in_array($_POST['ftp_path'], array('', '/'))) { - $ftp_root = strtr($boarddir, array($_POST['connect_path'] => '')); + $ftp_root = strtr(ROOT_DIR, array($_POST['connect_path'] => '')); if (substr($ftp_root, -1) == '/' && ($_POST['connect_path'] == '' || substr($_POST['connect_path'], 0, 1) == '/')) $ftp_root = substr($ftp_root, 0, -1); } else - $ftp_root = $boarddir; + $ftp_root = ROOT_DIR; $context['connect_details']['path'] = $ftp_root; } diff --git a/core/app/Subs-Template.php b/core/app/Subs-Template.php index e3fc941b..81ad249e 100644 --- a/core/app/Subs-Template.php +++ b/core/app/Subs-Template.php @@ -829,7 +829,7 @@ function start_output() */ function while_we_re_here() { - global $txt, $settings, $context, $boarddir, $cachedir; + global $txt, $settings, $context; static $checked_security_files = false, $showed_banned = false, $showed_behav_error = false; // If this page was loaded through jQuery, it's likely we've already had the warning shown in its container... @@ -856,10 +856,10 @@ function while_we_re_here() $security_files = array('import.php', 'install.php', 'webinstall.php', 'upgrade.php', 'convert.php', 'repair_paths.php', 'repair_settings.php', 'Settings.php~', 'Settings_bak.php~'); foreach ($security_files as $i => $security_file) - if (!file_exists($boarddir . '/' . $security_file)) + if (!file_exists(ROOT_DIR . '/' . $security_file)) unset($security_files[$i]); - if (!empty($security_files) || (!empty($settings['cache_enable']) && !is_writable($cachedir))) + if (!empty($security_files) || $cache_not_writable = (!empty($settings['cache_enable']) && !is_writable(ROOT_DIR . '/gz'))) { loadLanguage('Errors'); @@ -879,7 +879,7 @@ function while_we_re_here() ', sprintf($txt['not_removed_extra'], $security_file, substr($security_file, 0, -1)), '
'; } - if (!empty($settings['cache_enable']) && !is_writable($cachedir)) + if (!empty($cache_not_writable)) echo ' ', $txt['cache_writable'], '
'; @@ -934,7 +934,7 @@ function while_we_re_here() */ function db_debug_junk() { - global $context, $boarddir, $settings, $txt; + global $txt, $settings, $context; global $db_cache, $db_count, $db_show_debug, $cache_count, $cache_hits; // Is debugging on? (i.e. it is set, and it is true, and we're not on action=viewquery or an help popup. @@ -990,7 +990,7 @@ function db_debug_junk() { if (file_exists($files[$i])) $total_size += filesize($files[$i]); - $files[$i] = strtr($files[$i], array($boarddir => '.')); + $files[$i] = strtr($files[$i], array(ROOT_DIR => '.')); } // A small trick to avoid repeating block names ad nauseam... @@ -1062,7 +1062,7 @@ function db_debug_junk() // Make the filenames look a bit better. if (isset($qq['f'])) - $qq['f'] = preg_replace('~^' . preg_quote($boarddir, '~') . '~', '...', $qq['f']); + $qq['f'] = preg_replace('~^' . preg_quote(ROOT_DIR, '~') . '~', '...', $qq['f']); $temp .= ' ' . ($is_select ? '' : '') . westr::nl2br(str_replace("\t", '   ', htmlspecialchars(ltrim($qq['q'], "\n\r")))) . ($is_select ? '' : '') . '
diff --git a/core/app/Themes.php b/core/app/Themes.php index 7b0e95b3..a11e4b95 100644 --- a/core/app/Themes.php +++ b/core/app/Themes.php @@ -52,7 +52,7 @@ void ThemeInstall() - installs new themes, either from a gzip or copy of the default. - requires an administrator. - - puts themes in $boardurl/Themes. + - puts themes in ROOT/Themes. - assumes the gzip has a root directory in it. (ie default.) - accessed with ?action=admin;area=theme;sa=install. @@ -133,7 +133,7 @@ function Themes() function ThemeAdmin() { - global $context, $boarddir, $settings; + global $context, $settings; loadLanguage('Admin'); isAllowedTo('admin_forum'); @@ -150,11 +150,11 @@ function ThemeAdmin() $context['themes'][1]['skins'] = wedge_get_skin_list(); // Can we create a new theme? - $context['can_create_new'] = is_writable($boarddir . '/Themes'); - $context['new_theme_dir'] = substr(realpath($boarddir . '/Themes'), 0, -7); + $context['can_create_new'] = is_writable(ROOT_DIR . '/Themes'); + $context['new_theme_dir'] = substr(realpath(ROOT_DIR . '/Themes'), 0, -7); // Look for a non-existent theme directory. (i.e. theme87.) - $theme_dir = $boarddir . '/Themes/theme'; + $theme_dir = ROOT_DIR . '/Themes/theme'; $i = 1; while (file_exists($theme_dir . $i)) $i++; @@ -194,15 +194,15 @@ function ThemeAdmin() // !! @todo: remove completely! function ThemeList() { - global $context, $boarddir, $boardurl; + global $context; loadLanguage('Admin'); isAllowedTo('admin_forum'); loadTemplate('Themes'); - $context['reset_dir'] = realpath($boarddir . '/Themes'); - $context['reset_url'] = $boardurl . '/Themes'; + $context['reset_dir'] = realpath(ROOT_DIR . '/Themes'); + $context['reset_url'] = ROOT . '/Themes'; wetem::load('list_themes'); } @@ -382,7 +382,7 @@ function PickTheme() // !! @todo: remove this. function ThemeInstall() { - global $boarddir, $boardurl, $txt, $context, $settings; + global $txt, $context, $settings; checkSession('request'); @@ -422,7 +422,7 @@ function ThemeInstall() if ((!empty($_FILES['theme_gz']) && (!isset($_FILES['theme_gz']['error']) || $_FILES['theme_gz']['error'] != 4)) || !empty($_REQUEST['theme_gz'])) $method = 'upload'; - elseif (isset($_REQUEST['theme_dir']) && rtrim(realpath($_REQUEST['theme_dir']), '/\\') != realpath($boarddir . '/Themes') && file_exists($_REQUEST['theme_dir'])) + elseif (isset($_REQUEST['theme_dir']) && rtrim(realpath($_REQUEST['theme_dir']), '/\\') != realpath(ROOT_DIR . '/Themes') && file_exists($_REQUEST['theme_dir'])) $method = 'path'; else $method = 'copy'; @@ -430,10 +430,10 @@ function ThemeInstall() if (!empty($_REQUEST['copy']) && $method == 'copy') { // Hopefully the themes directory is writable, or we might have a problem. - if (!is_writable($boarddir . '/Themes')) + if (!is_writable(ROOT_DIR . '/Themes')) fatal_lang_error('theme_install_write_error', 'critical'); - $theme_dir = $boarddir . '/Themes/' . preg_replace('~[^A-Za-z0-9_\- ]~', '', $_REQUEST['copy']); + $theme_dir = ROOT_DIR . '/Themes/' . preg_replace('~[^A-Za-z0-9_\- ]~', '', $_REQUEST['copy']); umask(0); mkdir($theme_dir, 0777); @@ -507,7 +507,7 @@ function ThemeInstall() elseif ($method = 'upload') { // Hopefully the themes directory is writable, or we might have a problem. - if (!is_writable($boarddir . '/Themes')) + if (!is_writable(ROOT_DIR . '/Themes')) fatal_lang_error('theme_install_write_error', 'critical'); loadSource('Subs-Package'); @@ -515,17 +515,17 @@ function ThemeInstall() // Set the default settings... $theme_name = strtok(basename(isset($_FILES['theme_gz']) ? $_FILES['theme_gz']['name'] : $_REQUEST['theme_gz']), '.'); $theme_name = preg_replace(array('/\s/', '/\.{2,}/', '/[^\w.-]/'), array('_', '.', ''), $theme_name); - $theme_dir = $boarddir . '/Themes/' . $theme_name; + $theme_dir = ROOT_DIR . '/Themes/' . $theme_name; if (isset($_FILES['theme_gz']) && is_uploaded_file($_FILES['theme_gz']['tmp_name']) && (ini_get('open_basedir') != '' || file_exists($_FILES['theme_gz']['tmp_name']))) - $extracted = read_tgz_file($_FILES['theme_gz']['tmp_name'], $boarddir . '/Themes/' . $theme_name, false, true); + $extracted = read_tgz_file($_FILES['theme_gz']['tmp_name'], ROOT_DIR . '/Themes/' . $theme_name, false, true); elseif (isset($_REQUEST['theme_gz'])) { // Check that the theme is from wedge.org, for now... maybe add mirroring later. if (preg_match('~^http://[\w-]+\.wedge\.org/~', $_REQUEST['theme_gz']) == 0 || strpos($_REQUEST['theme_gz'], 'dlattach') !== false) fatal_lang_error('only_on_wedge'); - $extracted = read_tgz_file($_REQUEST['theme_gz'], $boarddir . '/Themes/' . $theme_name, false, true); + $extracted = read_tgz_file($_REQUEST['theme_gz'], ROOT_DIR . '/Themes/' . $theme_name, false, true); } else redirectexit('action=admin;area=theme;sa=admin;' . $context['session_query']); @@ -536,7 +536,7 @@ function ThemeInstall() { // Defaults. $install_info = array( - 'theme_url' => $boardurl . '/Themes/' . basename($theme_dir), + 'theme_url' => ROOT . '/Themes/' . basename($theme_dir), 'theme_dir' => $theme_dir, 'name' => $theme_name ); @@ -589,7 +589,7 @@ function ThemeInstall() function EditTheme() { - global $context, $boarddir; + global $context; // !!! Should this be removed? if (isset($_REQUEST['preview'])) @@ -775,7 +775,7 @@ function EditTheme() } $context['allow_save'] = is_writable($theme_dir . '/' . $_REQUEST['filename']); - $context['allow_save_filename'] = strtr($theme_dir . '/' . $_REQUEST['filename'], array($boarddir => '...')); + $context['allow_save_filename'] = strtr($theme_dir . '/' . $_REQUEST['filename'], array(ROOT_DIR => '...')); $context['edit_filename'] = htmlspecialchars($_REQUEST['filename']); if (substr($_REQUEST['filename'], -4) == '.css') diff --git a/core/app/ViewQuery.php b/core/app/ViewQuery.php index 5921b507..6f3c7d92 100644 --- a/core/app/ViewQuery.php +++ b/core/app/ViewQuery.php @@ -22,7 +22,7 @@ */ function ViewQuery() { - global $context, $db_connection, $settings, $boarddir, $txt, $db_show_debug; + global $context, $db_connection, $settings, $txt, $db_show_debug; $show_debug = !empty($db_show_debug); // We should have debug mode enabled, as well as something to display! @@ -99,7 +99,7 @@ function ViewQuery() // Make the filenames look a bit better. if (isset($query_data['f'])) - $query_data['f'] = preg_replace('~^' . preg_quote($boarddir, '~') . '~', '...', $query_data['f']); + $query_data['f'] = preg_replace('~^' . preg_quote(ROOT_DIR, '~') . '~', '...', $query_data['f']); $is_select_query = substr(trim($query_data['q']), 0, 6) == 'SELECT'; if ($is_select_query) diff --git a/core/app/media/Aeva-Foxy.php b/core/app/media/Aeva-Foxy.php index 30d0a3c5..6ef51653 100644 --- a/core/app/media/Aeva-Foxy.php +++ b/core/app/media/Aeva-Foxy.php @@ -1018,7 +1018,7 @@ function aeva_foxy_get_xml_comments() function aeva_foxy_album($id, $type, $wid = 0, $details = '', $sort = 'm.id_media DESC', $field_sort = 0) { - global $context, $amSettings, $boarddir, $txt, $galurl, $boardurl; + global $context, $amSettings, $txt, $galurl; $det = empty($details) || $details[0] == 'all' ? 'all' : ($details[0] == 'no_name' ? 'no_name' : ''); if ($det == 'all' || $det == 'no_name') @@ -1134,7 +1134,7 @@ function aeva_foxy_album($id, $type, $wid = 0, $details = '', $sort = 'm.id_medi $playlist = array(); $has_album = array(); $has_type = array('audio' => 0, 'video' => 0, 'image' => 0); - $clearurl = $boardurl . str_replace($boarddir, '', $amSettings['data_dir_path']); + $clearurl = str_replace(ROOT_DIR, ROOT, $amSettings['data_dir_path']); while ($row = wesql::fetch_assoc($request)) { if (in_array($type, array('audio', 'video', 'media')) && empty($playlist_description)) @@ -1343,7 +1343,7 @@ function aeva_foxy_album($id, $type, $wid = 0, $details = '', $sort = 'm.id_medi function aeva_foxy_fill_player(&$playlist, $type, &$details, $play = 0, $wid = 470, $hei = 430, $thei = 70) { - global $boardurl, $amSettings, $context, $txt; + global $amSettings, $context, $txt; static $swo = 0; $swo++; @@ -1444,7 +1444,7 @@ function aeva_foxy_fill_player(&$playlist, $type, &$details, $play = 0, $wid = 4 bcol: "' . $pcol . '",' : '', !empty($bcol) ? ' scol: "' . $bcol . '",' : '', ' duration: ', floor($first['duration']), ', - install: "', $boardurl, '/expressInstall.swf", + install: "', ROOT, '/expressInstall.swf", height: ', $thei, ' });'); diff --git a/core/app/media/Aeva-Gallery.php b/core/app/media/Aeva-Gallery.php index 8f5917e1..de2201e5 100644 --- a/core/app/media/Aeva-Gallery.php +++ b/core/app/media/Aeva-Gallery.php @@ -730,7 +730,7 @@ function aeva_prevNextThumb($myurl, &$prev) function aeva_viewItem() { // Comes into play when you're viewing a single item - global $galurl, $txt, $amSettings, $context, $memberContext, $boarddir; + global $galurl, $txt, $amSettings, $context, $memberContext; // Set the item ID $item = isset($_REQUEST['in']) ? (int) $_REQUEST['in'] : 0; @@ -753,7 +753,7 @@ function aeva_viewItem() $peralbum['autosize'] = !empty($peralbum['autosize']) && $peralbum['autosize'] == 'no' ? 'no' : 'yes'; $amSettings['use_zoom'] &= empty($peralbum['zoom']) || $peralbum['zoom'] == 'yes'; $context['aeva_has_preview'] = (bool) $item_data['has_preview']; - $amSettings['show_linking_code'] = empty($amSettings['show_linking_code']) || ($item_data['type'] == 'unknown') ? 0 : (1 + (file_exists($boarddir . '/MGalleryItem.php') ? 0 : 1)); + $amSettings['show_linking_code'] = empty($amSettings['show_linking_code']) || ($item_data['type'] == 'unknown') ? 0 : (1 + (file_exists(ROOT_DIR . '/MGalleryItem.php') ? 0 : 1)); // Handle rating and stuff // Any previous rates? diff --git a/core/app/media/ManageMedia.php b/core/app/media/ManageMedia.php index 16b94adc..965bda07 100644 --- a/core/app/media/ManageMedia.php +++ b/core/app/media/ManageMedia.php @@ -211,10 +211,7 @@ function aeva_admin_settings() ); if (empty($amSettings['data_dir_url']) && !empty($amSettings['data_dir_path'])) - { - global $boardurl, $boarddir; - $amSettings['data_dir_url'] = $boardurl . str_replace($boarddir, '', $amSettings['data_dir_path']); - } + $amSettings['data_dir_url'] = str_replace(ROOT_DIR, ROOT, $amSettings['data_dir_path']); $info = array('datetime', 'copyright', 'xposuretime', 'flash', 'duration', 'make', 'model', 'xres', 'yres', 'resunit', 'focal_length', 'orientation', 'iso', 'meteringMode', 'digitalZoom', 'exifVersion', 'contrast', 'sharpness', 'focusType', 'fnumber','frame_count', 'bit_rate', 'audio_codec', 'video_codec'); $th['show_info'] = array('checkbox', 'meta', array());